maximum and minimum value in a dictionary code example
Example 1: python get the key with the max or min value in a dictionary
key_with_max_value = max(dictionary, key=dictionary.get)
max_value = dictionary[max(dictionary, key=dictionary.get)]
max_value = max(dictionary.values())
dictionary = {"a": 1, "b": 2, "c": 3}
max(dictionary, key=dictionary.get)
--> 'c'
Example 2: python get min max value from a dictionary
d = {'A': 4,'B':10}
min_v = min(zip(d.values(), d.keys()))
max_v = max(zip(d.values(), d.keys()))