How to do this recursive? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to do this recursive?

https://code.sololearn.com/cJjDXZ8jMhdF/?ref=app I’m noob this is one of my first program and I don’t have enough exp

5th Feb 2020, 9:00 AM
Lorenzo Sebastianelli
Lorenzo Sebastianelli - avatar
1 Answer
+ 7
If the first element is equal to x, return True. If the list is empty (because you already went through to the end), return False. If the first element of the iterable is unequal to what you search for, you return another call of the function, with only the part of the list after the first element. Can you do it from here? Please show us your attempt!
5th Feb 2020, 9:09 AM
HonFu
HonFu - avatar