The index( ) Function is used to return the first occurrence of an element in the Tuple.
Let us say, we have a Tuple that contains three names, 'Mohan', 'Kriti' and 'Salim'. And we want to find the location of 'Kriti'.
x = ("Mohan", "Kriti", "Salim") y = x.index("Kriti") print("The position of Kriti is ",y)
So, in the above code we have created a 'Tuple' and initialised to the variable 'x'.
Below is how the values are positioned in the Tuple,
Now, if we see the above diagram, 'Kriti' resides at position/index '1'.
And the 'index( )' Function is used to find the position of 'Kriti'.
And we get the below output,