tuples = [(1, 'apple'), (2, 'banana'), (0, 'cherry')] sorted_tuples = sorted(tuples, key=lambda x: x[1]) print(sorted_tuples)
[(1, 'apple'), (0, 'cherry'), (2, 'banana')]
[(2, 'banana'), (1, 'apple'), (0, 'cherry')]
[(0, 'cherry'), (1, 'apple'), (2, 'banana')]
[(1, 'apple'), (2, 'banana'), (0, 'cherry')]