def recur(y):
if y>0:
print(y)
recur(y-1)
print("all the recursive calls are done, now printing the stack") # I want this statement printed only once
print(y)
recur(5)
I want the print statement to be printed only once. I don't want to use if y>4 print() that defect the purpose.
I want the output to be like this:
5
4
3
2
1
all the recursive calls are done, now printing the stack
1
2
3
4
5