Created
November 21, 2018 10:58
-
-
Save JackInTaiwan/211f2cb0df1c7b51c59e6747ffdcdad1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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