What is the output of the following Python code snippet?
a = [1, 2, 3]
a.reverse()
print(a)
a.reverse()
print(a)
Correct answer
C. [3, 2, 1]
5 views
C. [3, 2, 1]
5 views
reverse() reverses the list in place.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is C? Ask here and get an explanation.