In [2]:
def to_index(input_list,a):
index = 0
for item in input_list:
index = index + 1
if item == a:
return index - 1
In [3]:
L=[1,2,3,4,5]
to_index(L,2)
Out[3]:
In [ ]: