Q. What is the output of this code snippet?
Code:
x = [1, 2, 3] print(x[-1])
β
Correct Answer: (B)
3
Explanation: Negative indices access elements from the end; -1 refers to the last element.