Definition
The index() method finds the first occurrence of the specified value. It raises an exception if the value is not found.
Syntax
tuple.index(value)
Parameters
Parameter | Description |
---|---|
value | Required. The item to search for. |
Examples:
myNumbers = (1, 89, 27, 81, 27, 55, 47, 62, 84, 50)
k = myNumbers.index(27)
print(k)