0

How to work this function.detailed explain each itearation steps ?can u any onee?

def tri_recursion(k): if(k>0): result=k+tri_recursion(k-1) print (result) else: result=0 return result Print ("\n\n Recursion Example Results") tri_recursion(6)

20th Aug 2020, 11:00 AM
Mkchowdary
Mkchowdary - avatar
3 Answers
0
Asking Dout bro
20th Aug 2020, 11:24 AM
Mkchowdary
Mkchowdary - avatar
0
How to check conditions in itearations
20th Aug 2020, 11:24 AM
Mkchowdary
Mkchowdary - avatar
0
Whenever tri_recursion called with value 6..then cursor goes to function and checks 6>0(k>0) ..here the condition is true so result=6+tri_recursion(6-1) Next result=6+5+tri_recursion(5-1) result=6+5+4+tri_recursion(3-1) . . . .result=6+5+4+3+2+1+tri_recursion(1-1) Whenever 1-1=0 occurs then returning result 21
9th Feb 2024, 2:21 PM
MYTHRI PERNI
MYTHRI PERNI - avatar