Q. What is the output of the following code?
Code:
x = [1, 2, 3] print(x[-1])
β
Correct Answer: (C)
3
Explanation: Negative indexing starts from the end. x[-1] refers to the last element, which is 3.