Definition
The index() method returns the position at the first occurrence of the specified value.
Syntax
list.index(n)
Parameters
Parameter | Description |
---|---|
n | Required. Any type (string, number, list, etc.). The element to search for |
Examples:
cars = ['Nissan', 'Ford', 'Volkswagen']
j = cars.index('Ford')
print(j)