Computer Science, asked by mrdelightlive, 5 months ago

s-7) Suppose list1 is [1, 3, 5, 12,5), what is list1.index(5)?​

Answers

Answered by Anonymous
6

Answer:

list1= [1, 3, 5, 12,5]

n=list1.index(5)

print(n)

list1.index(5) will print 2

Remember these:

  • The index() method returns the index of the given element in the list.
  • The index() method only returns the first occurrence of the matching element.
  • If the element is not found, a ValueError exception is raised.

Similar questions