What is the output of print([5, 6, 7].index(7)) in Python?
print([5, 6, 7].index(7))
Correct answer
D. 2
5 views
D. 2
5 views
index() returns the position of the first matching element.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is D? Ask here and get an explanation.