What is the output of print(sorted([3, 1, 2], key=lambda x: x)) in Python?
print(sorted([3, 1, 2], key=lambda x: x))
Correct answer
B. [1, 2, 3]
5 views
B. [1, 2, 3]
5 views
The key parameter accepts any function, including lambdas.
Asked in: Python Interview Functions
https://docs.python.org/3/tutorial/controlflow.html#defining-functionsNot sure why the answer is B? Ask here and get an explanation.