Python Implementation for All Occurences

I wrote the Python implementation for the this:
def alloccurences(ls, start, key):
if start == len(ls) - 1 and ls[start] != key:
return

if ls[start] == key:
    print(start, "-->", key)

alloccurences(ls, start+1, key)

It prints the occurrences and also gives index out of bound error. for this input
ls = [1,2,3,4,5,20,20]
start = 0
key = 20

Can you correct the above code pls

hi @tonymathen
kindly save ur code on ide and send link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.