List index(obj) Method

In Python Built-In List index(obj) method is used to return the lowest index that obj appears in the given list.

Syntax:
There is 1 Parameter used in the list index(obj) method: obj Shows the object to be to find out in the list.
Example:
#method

list1 = ['TOM', 'JOHN', 'ALICE']
list1.extend(list1)
print ("Index for TOM : ", list1.index( 'TOM' ) )
print ("Index for ALICE : ", list1.index( 'ALICE' )) 

Comments are closed.