What is the output of the following code snippet?
my_tuple = (1, 2, 3, 4, 5)
result = my_tuple.index(3)
print(result)
Answer: A
The index() method in Python returns the index of the first occurrence of the specified element in the tuple. In this case, the element 3 is at index 2 in the tuple my_tuple, so 2 will be printed.
Discuss About this Question.