Skip to main content
5 of 6
deleted 17 characters in body
pxeger
  • 24.6k
  • 4
  • 53
  • 141

Python, 39 bytes

def f(a,x):print(a.index(x));f(a[1:],x)

Attempt This Online!

Finishes with an exception

-5 bytes thanks to AnttiP

Whython, 41 bytes

def f(a,x):print(a.index(x))+f(a[1:],x)?0

Attempt This Online!

No error

pxeger
  • 24.6k
  • 4
  • 53
  • 141