Syntax:
list.index(x[, start[, end]])
The index() returns zero-based index in the list of the first item whose value is equal to x and raises a ValueError if there is no such item.
Arguments:
- x = item whose lowest index will be returned
- start and end (optional) = used to limit the search to a particular subsequence of the list
Example Implementation
Scenario 1: retrieve index without providing optional arguments
Scenario 2: retrieve index, providing the start and end limit
Scenario 3: Demonstrating the ValueError
need an explanation for this answer? contact us directly to get an explanation for this answer