In this example, you will learn how to get the minimum value in a dictionary.
Example: Get key with max value and key
1 2 3 4 5 6 7 8 9 10 11 12 | dictionary = {"a": 5, "b": 2, "c": 8} # get key with min value max_key = max(dictionary, key=dictionary.get) print(max_key) # print output => "c" print(dictionary.get(max_key)) # max value |
Output:
1 2 3 4 | c 8 |