Contact: aviboots(AT)netvision.net.il
39,009 questions
50,723 answers
573 users
import operator dic = {'a':13, 'b':96, 'c':8, 'd':24, 'e':36, 'f':17} mn = min(dic.items(), key=operator.itemgetter(1))[0] print(mn) ''' run: c '''
import operator dic = {'a':13, 'b':96, 'c':8, 'd':24, 'e':36, 'f':17} mn = min(dic.items(), key=operator.itemgetter(1)) print(mn) ''' run: ('c', 8) '''
dic = {'a':13, 'b':96, 'c':8, 'd':24, 'e':36, 'f':17} mn = min(dic, key = dic.get) print(mn) ''' run: c '''
dic = {'a':13, 'b':96, 'c':8, 'd':24, 'e':36, 'f':17} mn = min(dic, key=lambda key: dic[key]) print(mn) ''' run: c '''