Home >>Python List Methods >Python List index() Method

Python List index() Method

Python List index() Method

Python list index() method is used to return the position at the first occurrence of the specified given input value.

Syntax:
list.index(element)

Parameter Values

Parameter Description
element This is a required parameter. It defines the element to search for.
Here is an example of Python index() method:

a = ['Abhi', 'Mike', 'Jerry']
x = a.index("Jerry")
print(x)

Output:
2
Example 2:

a = [4, 55, 64, 32, 16, 69, 32, 45, 23, 55]
x = a.index(69)
print(x)

Output:
5