def fact(n):
space = ' ' * (5 * n)
print(space, 'factorial', n)
if n == 0:
print(space, 'returning', 1)
return 1
else:
result = n * fact(n-1)
print(space, 'returning', result)
return result
fact(5)
ZGVmIGZhY3Qobik6CiAgICAgc3BhY2UgPSAnICcgKiAoNSAqIG4pCiAgICAgcHJpbnQoc3BhY2UsICdmYWN0b3JpYWwnLCBuKQogICAgIGlmIG4gPT0gMDoKICAgICAgICBwcmludChzcGFjZSwgJ3JldHVybmluZycsIDEpCiAgICAgICAgcmV0dXJuIDEgCiAgICAgZWxzZToKICAgICAgICByZXN1bHQgPSBuICogZmFjdChuLTEpCiAgICAgICAgcHJpbnQoc3BhY2UsICdyZXR1cm5pbmcnLCByZXN1bHQpIAogICAgICAgIHJldHVybiByZXN1bHQKIApmYWN0KDUpCg==