Sort a dictionary in alphabetical order by the value, and print. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Sort a dictionary in alphabetical order by the value, and print.

1. Sorting Dictionaries: • Create a dictionary of 20 humans and their pets (name of human is the key, and name of pet is the value). • Sort the dictionary in alphabetical order by the key, and print. • Sort the dictionary in alphabetical order by the value, and print.

12th Jun 2021, 10:33 PM
nai
2 Answers
+ 4
I see that you seem to be asking how to sort a dictionary only by the value, but the task 1st requires you to sort by the key and then again by the value. Where is your coded attempt? Depending on how/if you coded the 1st sorted part by the key, you may be able to sort by value in a similar way. Share your attempt and we can help you further.
12th Jun 2021, 11:28 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
This looks like homework! Do you have an attempt to post with your query?
12th Jun 2021, 11:30 PM
Rik Wittkopp
Rik Wittkopp - avatar