+ 1
Guys..How recursion is actually working? I'm so confused 😕
Def tri_recursion (x): if x>0: result= x + tri_recursion (x-1) print ( result) else : return = 0 return result tri_recursion (8)
3 Respostas
+ 2
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2465/?ref=app
Read this,this article is very helpful for me try this
+ 6
tri_recursion(8) will be treated like thi:-
result= 8 + tri_recursion(7)
= 8+7+tri_recursion(6)
=8+7+6+tri_recursion(5)
=8+7+6+5+tri_recursion(4)
.
.
.
.
=8+7+6+5+4+3+2+1+tri_recursion(0)
=8+7+6+5+4+3+2+1+0 as tri_resursion(0) is 0
So the final value of result is 28
+ 2
Feels like this belongs here xD
https://www.sololearn.com/discuss/307407/?ref=app