Say I have a list x = [1, 2, 3, 4, 5, 3, 4]
Is there any recursive method to find if the element a
(let's say a = 3
) is in the list using only the condition if not x:
and the instruction list.pop([i])
?
def rec(lista, goal):
if not lista:
return False
return (goal==lista.pop() or rec(lista, goal))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments