24
Question Question 24
Running the code sorted(my_dictionary, reverse = True) on a dictionary named my_dictionary will return results sorted in what order?
- Ascending order (A-Z), by key
- Ascending order (A-Z), by value
- Descending order (Z-A), by key
- Descending order (Z-A), by value
Descending order (Z-A), by key
Reason — The sorted() function returns a sorted list of dictionary keys. By default, the sort order is ascending. To sort the keys in descending order, the reverse parameter must be set to true as an optional argument (sorted(my_dictionary, reverse = True)).