Last active
July 6, 2016 10:43
-
-
Save brettfreer/4e0751568a06527626e3005e2585351e to your computer and use it in GitHub Desktop.
Return the key with the maximum value in a dictionary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
def max_value(m): | |
return max(m.iteritems(), key=operator.itemgetter(1))[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment