dict = {"Python":750,"Java":950,"Ruby":700,"C++":200}
sort_values = sorted(dict.items(), key=lambda y: y[1], reverse=True)
for i in sort_values:
print(i[0], i[1])
1. new_list = sorted(old_list, key=lambda k: k['key'], reverse=True)
/*use reverse=False for ascending order*/
import operator
d = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}
print('Original dictionary : ',d)
sorted_d = sorted(d.items(), key=operator.itemgetter(1))
print('Dictionary in ascending order by value : ',sorted_d)
sorted_d = dict( sorted(d.items(), key=operator.itemgetter(1),reverse=True))
print('Dictionary in descending order by value : ',sorted_d)