This should be super simple, I know, but I think there's something inherent about recursion I am not getting. The below code works but is not recursive. I think I just cannot wrap my head around using recursion when it doesn't seem necessary. Anyway. I've been knocking my head against a wall with this for a while, any help appreciated!
def contains_element(my_list, elem):
i=0
while i< len(my_list):
if my_list[i]==elem:
return True
i+=1
return False
print(contains_element([1, 2, 3, 4, 5], 5))