When in doubt, go back to yourself.

--Originally published at Just A Turtle Coding.

So recursion is a useful resource in Python. It will save you lots of lines of code, bytes of memory and lots of time. Here’s how you do it:

To use this technique, you just have to include the same function you’re defining in the same function. An example is represented here:

The factorial function is recurring by definition but here’s an example of what or how it’s done. For more info, check out this post:

http://kenscourses.com/tc101winter2015/2015/use-of-recursion-for-repetitive-algorithms-6/