0
Can any one explain me this code?
def is_even(x): if x == 0: return True else: return is_odd(x-1) #what this will do def is_odd(x): return not is_even(x) print(is_odd(17)) print(is_even(23))
5 Answers
+ 6
Please take a pencil and a Sheet of paper and follow each step.
Sooner or later you will understand.
Understanding recursion is a long process that cant be done with a post here.
your brain muscles must learn completely new moves.
+ 5
Kishalaya Saha cool stuff
+ 2
Hi Mahesh, I had tried to explain a similar code with smaller inputs many months ago. Maybe it'll help.
https://www.sololearn.com/Discuss/1532322/?ref=app
+ 1
Tq Kishalaya Saha
0
Ok tq