Source Code:
(back to article)
d = {'apple': 1, 'banana': 3, 'orange': 2} sorted_d = dict(sorted(d.items(), key=lambda x: x[1])) print(sorted_d) # Output: {'apple': 1, 'orange': 2, 'banana': 3}
Result:
Report an issue