Day: March 21, 2022

Sorting Dictionary Items

Sorting dict items¶ Let us understand how we can sort the dict items in Python. dict is nothing but group of key value pairs where keys are unique. sorted on dict returns only sorted keys. In [7]: famous_players = { ‘Pete Sampras’: ‘Tennis’, ‘Sachin Tendulkar’: ‘Cricket’, ‘Brian Lara’: ‘Cricket’, ‘Diego Maradona’: ‘Soccer’, ‘Roger Federer’: ‘Tennis’, ‘Ian …

Sorting Dictionary Items Read More »