because when n < 1 your function will not return anything explicitly, so it returns
Check this visualization tool
None
and thus the error.Check this visualization tool
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs