python how to find the highest number in a dictionary

a_dictionary = {"a": 1, "b": 2, "c": 3}

max_key = max(a_dictionary, key=a_dictionary.get)
get key with max value


Here is what the above code is Doing:
1. max() is a built-in function that takes an iterable and returns the largest item in it.
2. The key argument is a function that takes one argument and returns a key to use for sorting purposes.
3. a_dictionary.get is a function that takes one argument (a key) and returns the value of that key in the dictionary.
4. max() is called with the dictionary and the key argument set to a_dictionary.get.
5. max() returns the key with the largest value.