What is the output of print([1, 2, 3][::-1]) in Python?
print([1, 2, 3][::-1])
Correct answer
A. [3, 2, 1]
5 views
A. [3, 2, 1]
5 views
The slice [::-1] returns a reversed copy.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is A? Ask here and get an explanation.