What is the output of print(sorted([2, 3, 1], reverse=True)) in Python?
print(sorted([2, 3, 1], reverse=True))
Correct answer
D. [3, 2, 1]
5 views
D. [3, 2, 1]
5 views
reverse=True sorts in descending order.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is D? Ask here and get an explanation.