Python List index() Method

Python List index() Method

  • The index() method searches an element in the list and returns its index.

  • The index() method finds the given element in a list and returns its position. 

  • If the same element is present more than once, the method returns the index of the first occurrence of the element.

Syntax

  • list.index(element)

Parameter Values

This method takes a single argument. 

  • element - element that is to be searched.

Return value

  • The method returns the index of the element in the list.


 

 

 

 

Comments