import operator dict={1:12,3:14,4:13,2:11,0:10} print ("the origial dict is:",dict) print(dict.items()) ascending=sorted(dict.items(),key=operator.itemgetter(0)) print("the dictionary in ascending order by value is :",ascending) descending=sorted(dict.item(),key=operator.itemgetter(0),reverse=True) print("the dictionary in descending order by value is :",descending)