I am learning resursion recently and I wrote a simple recursive function to verify my understanding:
def hello(n):
if n == 1:
return 'hello'
else:
print('hello')
hello(n-1)
def returnhello():
return 'hello'
print(returnhello())
print()
print(hello(5))
the output of this is shown here:
hello
hello
hello
hello
hello
None
Why the last call in the recursion prints None instead of hello? I was expecting it to print 5 hello