sort a dictionary based on values returned as list of tuples
a = {1:5, 2:4, 3:7, 4:6} a_sorted = sorted(a.items(), key=lambda x:x[1]) print(a_sorted)