Source Code:
(back to article)
original_dict = {'c': 3, 'a': 1, 'b': 2} # Sort the dictionary by values and iterate over the items for key, value in sorted(original_dict.items(), key=lambda item: item[1]): print(key, value)
Result:
Report an issue