Python Programming 28 - Sort with the Sorted Method

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

Love all the short videos. Went through your first series and now this new one. Good stuff. Thanks.

jeffpdx
Автор

Terrific, thanks! Two mins well spent :D

BethanyLowe
Автор

you should have explained how the key can be used to sort based on different parameters in dictionaries or many other things ( e.g [{'name': 'A', 'marks': 50},
{'name': 'B', 'marks': 100},
{'name': 'C', 'marks': 40},
{'name': 'D', 'marks': 70},
{'name': 'E', 'marks': 60}]
Sort on basis of name :sorted(students, key = lambda x:x['name'], reverse=True)
Sort on basis of marks : sorted(students, key = lambda x:x['marks'], reverse=True)

bubblebath