Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
prices = [
("ice cream", 80),
("bike", 20000),
("water", 30),
]
sorted_by_price = sorted(prices, key=lambda x: x[1])
print(sorted_by_price)
# > [('water', 30), ('ice cream', 80), ('bike', 20000)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.