In this example, you will learn how to get the minimum value in a dictionary.
Example: Get key with min 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 min_key = min(dictionary, key=dictionary.get) print(min_key) # print output => "b" print(dictionary.get(min_key)) # min value |
Output:
1 2 3 4 | b 2 |