How to compare the value in the dictionary of python

Here’s one way:

Dictionary = {(4, 5): (2.733), (5, 2): (2.4533), (6, 2): (4.533), (7, 3): (1.333)}
dictList=zip(Dictionary.values(),Dictionary.keys())
dictList.sort()
smallest=dictList[0][1]
print smallest
>>>(7, 3)

–Mitch

1 Like