Python Programming - Data Types - Discussion
Discussion Forum : Data Types - General Questions (Q.No. 60)
60.
What is the output of the following code snippet?
my_tuple = (1, 2, 3, 4, 5)
result = my_tuple.index(3)
print(result)
Answer: Option
Explanation:
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.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers