Function Details: index_(list)

Description


Returns the index of the first occurrence of the specified value.


Extended Description


The index() method returns the index of the first occurrence of the specified value in the list. If the value is not found, it raises a ValueError. Optional start and end parameters can be used to limit the search to a specific slice of the list. The search is performed from left to right.


Function Signature


list.index(value: Any, start: int = 0, end: int = None) -> int

Module: list

Class: list

Parameters



Parameter List


  • value: Any
  • start: int
  • end: int

Return


Returns an integer representing the index of the first occurrence of the specified value.


Return Type


int

Output

Explanation

This example shows finding the index of the first occurrence of values in the list.