Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- Then,
- key_max = max(my_dict.keys(), key=lookup)
- simply finds the key with the largest lookup value.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement