I have sorted a list of dictionary values and am trying to find the keys so I can print them in the order of the values. Here is my code:
list1=[]
dicts={'toy':3,'dino':4,'kite':9,'torch':1}
for key in dicts:
list1.append(dicts[key])
a=sorted(list1)
print(a)
if a[0]==dicts[key]:
print(dicts.value)
I cannot seem to find the key which corresponds to the value. Can someone help me?