0
please help me to how to work this code
def sum(x,y): if(y==0): return x; else: return(1+sum(x,y-1)); x=10 y=20 print("Sum of two numbers are: ",sum(x,y))
5 Answers
+ 4
What is it supposed to do?
If you want to just add 2 numbers what are you trying to achieve with the recursion?
0
I went add two number with recursion
0
Did you run the code? What problem do you get?
0
it's run properly
0
This code recursed Y into series of 1, after finish, just add the series to X.