I have a dictionary contains keys and values:
dic1 = {'first': 13, 'second': 7, 'third': 5}
I want to compare the values and select key with the largest number: The output should be:
'first'
here is my code:
import operator
dic1 = {'first': 13, 'second': 7, 'third': 5}
total = [k:max(dic1.values()) for k,v in dic1.items()]
but I got SyntaxError..
any help?