Finding the Dictionary Key with Largest & Smallest Values

Python

 1|  # Key with the largest value
 2|  max(a_dictionary, key=a_dictionary.get)
 3|  
 4|  # Key with the the smallest value
 5|  min(a_dictionary, key=a_dictionary.get)
Did you find this snippet useful?

Sign up for free to to add this to your code library