Source Code:
(back to article)
fruits = [('apple', 10), ('banana', 5), ('cherry', 20), ('durian', 15), ('elderberry', 25)] sorted_fruits = sorted(fruits, key=lambda x: x[1]) print(sorted_fruits)
Result:
Report an issue