Write a python program to sort a list of tuples based on their second element.
list = [('dog', 6), ('cat', 4), ('rabbit', 2)]
list = [('dog', 6), ('cat', 4), ('rabbit', 2)]

list.sort(key=lambda x: x[1])

print(list)