Good piece.

Please note: at least one example of recursion you have might never end if the input is less than zero. This is handy to note: always check that the base cases cover all possible inputs and destinations.

Also note: recursion has a limit in Python. Yes, you can change the bottoming out limit of 1000, but there might be reason to consider an iterative approach or a more complicated dynamic approach if that looks like it could happen.

Resident of Frogpondia.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store