how to find maximum valued key in dictionary in python
- Let's give that lambda function a name:
- def lookup(k):
- return my_dict[k]
- All it does is lookup the key `k` in your dictionary.
- key_max = max(my_dict.keys(), key=lookup)
- simply finds the key with the largest lookup value.
RAW Paste Data