Answers for "# sort the dictionary"

0

# sort the dictionary

# sort the dictionary
d3 = {'apple': 1, 'oranges': 2, 'bananas': 3, 'grapes': 4, 'strawberries': 5, 'watermelon': 6}
sort_arr= dict(sorted(d3.items(), reverse = True))
print(sort_arr)

# {'watermelon': 6, 'strawberries': 5, 'oranges': 2, 'grapes': 4, 'bananas': 3, 'apple': 1}
Posted by: Guest on March-30-2022

Python Answers by Framework

Browse Popular Code Answers by Language