Home >>Python List Methods >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 | Description |
---|---|
element | This is a required parameter. It defines the element to search for. |
a = ['Abhi', 'Mike', 'Jerry']
x = a.index("Jerry")
print(x)
a = [4, 55, 64, 32, 16, 69, 32, 45, 23, 55]
x = a.index(69)
print(x)