def ind(e, L):
if e not in L:
return 0
else:
return 1 + ind(e, L[:1])
assert ind(42, [55, 77, 42, 12, 42, 100])
I want the index(so in this case I need 2), but the code always seems to give me the numbers instead. Also I can't use the index function in Python.
Please help if you got some time.