help us to understand the logic of the following code in Python(recursive function):
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)
Output:
Recursion Example Results
1
3
6
10
15
21
When I try to understand the logic of this program and try to predict the output I don't get the output I get only the print line output as "Recursion Example Results", but when I compile and execute it, the output comes like which I given above.