+ 1
explain this code.
def tri_recursion(k): if(k > 0): result = k + tri_recursion(k - 1) print(result) else: result = 0 return result print("\n\nRecursion Example Results") tri_recursion(6)
4 Answers
0
Given a value k, if k is greater than 0 print k + the result of tri_recursion(k -1).
Let k = 3
K > 0
Result = 3 + 5 (k-1 -> 2 + k -> 5)
Result = 8
0
5???
0
I can't understand
0
Can u explain briefly please