Python list.index() Method
The index() method returns the position at the first occurrence of
the specified value.
Syntax
list.index(elmnt)
Parameters
| Parameter | Description |
|---|---|
elmnt |
Required. The element to search for |
Return Value
The first index of the value. Raises a ValueError if the value is not found.
Example
Using the index() method:
Output
Click Run to execute your code
Enjoying these tutorials?