I have a dictionary in the form of:
my_dict = { "a" : ["Hey", 3] , "b" : ["Hello, 2], "c" : ["Heya", 8] }
(and every list is of the same format and "size"). I want to find the key that has the minimum value of each list's second column. In this example, based on the integer values, so the key I'd get is "b". I tried writing this as a list comprehension with lambda function but couldn't get it to work so I ended up with this:
min = 60 # with 60 being a logical maximum value
for key in my_dict:
if my_dict[key][1] < min:
min = wordDict[key][1]
min_key = key
min_key
Is there a more efficient and "elegant" way?