# dict has no order - use a list to store l = {1: 40, 2: 60, 3: 50, 4: 30, 5: 20} d1 = list(sorted(l.items(),key=lambda x:x[1],reverse=True))