xxxxxxxxxx
# we can not index "array"
# So, "array" should be converted to "list"
# As, "list" has property of "indexing"
xxxxxxxxxx
a_list = [1, 2, 3]
position_of_three = a_list.index(3)
print(position_of_three)
xxxxxxxxxx
#Example List
list = ['apples', 'bannas', 'grapes']
#Use Known Entites In The List To Find The Index Of An Unknown Object
Index_Number_For_Bannas = list.index('apples')
#Print The Object
print(list[Index_Number_For_Bannas])
xxxxxxxxxx
# Find index position of first occurrence of 'Ok' in the list
indexPos = listOfElems.index('Ok')
print('First index of element "Ok" in the list : ', indexPos)
xxxxxxxxxx
# To return the index of the first occurence of element x in lst
ind = lst.index(x)