Finding largest value in a dictionary
python
Solution
You can just use `max`
>>> x = {1:2, 3:6, 5:4}
>>> max(x, key=lambda i: x[i])
3
Or just:
>>> max(x, key=x.get)
3
Problem
Possible Duplicate: Getting key with maximum value in dictionary? Let's say I have a dictionary that is comprised of integer keys and integer values. I want to find the integer key with the highest corresponding value. Is there any built in method to do something like this or do I need to implement some kind of merge/sort algorithm?