Answers for "find max in values in dictionary python for few indices"

1

find the max value in dictionary python

my_dict = {'a': 5, 'b': 10, 'c': 6, 'd': 12, 'e': 7}
max(my_dict, key=my_dict.get) # returns 'd'
Posted by: Guest on October-10-2020
2

max element in dictionary python

import operator
stats = {'a':1000, 'b':3000, 'c': 100}
max(stats.iteritems(), key=operator.itemgetter(1))[0]
Posted by: Guest on March-18-2020

Code answers related to "find max in values in dictionary python for few indices"

Python Answers by Framework

Browse Popular Code Answers by Language