xxxxxxxxxx
# Sample list of tuples
lst = [(1, 4), (2, 2), (3, 6), (4, 1)]
# Sorting the list of tuples by the second element
sorted_list = sorted(lst, key=lambda x: x[1])
print(sorted_list)
xxxxxxxxxx
sorted([('abc', 121),('abc', 231),('abc', 148), ('abc',221)],
key=lambda x: x[1])