Advertisement
elena1234

LIST SORTING in Python

Feb 8th, 2022 (edited)
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. # List Sorting
  2. a = [(0, 2), (4, 3), (9, 9), (10, -1)]
  3. print(sorted(a, key = lambda x: x[1])) # [(10, -1), (0, 2), (4, 3), (9, 9)]
  4.  
  5. # sorted_list = (sorted(albums, key = lambda x: x["Artist"], reverse = True))
  6. # student_info.sort(key=lambda x: x['last name'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement