tegge-classroom / STAT2984-2018

STAT 2984: Statistical Programming I - Spring 2018
1 stars 13 forks source link

Sorting Within Dictionaries #13

Open jbyrne99 opened 6 years ago

jbyrne99 commented 6 years ago

How do you sort within a dictionary like we just did with lists?

abbyt99 commented 6 years ago

To sort by the keys you can use sorted(name_of_dict.keys()) but if you wanted to sort by the values you can use sorted(name_of_dict.values()) .