That concludes your journey through recursion, a programming technique in which a function calls itself. Recursion isn’t by any means appropriate for every task. But some programming problems virtually cry out for it. In those situations, it’s a great technique to have at your disposal.
In this video course, you learned:
- What it means for a function to call itself recursively
- When recursion might be your best best for solving a problem
- How you can implement recursion for various use cases in Python
You also saw several examples of recursive algorithms and compared them to corresponding non-recursive solutions.
You should now be in a good position to recognize when recursion is called for and be ready to use it confidently when it’s needed!
For further investigation, check out:
- Sorting Algorithms in Python
- Introduction to Sorting Algorithms in Python
- Draw the Mandelbrot Set in Python
- Real Python Episode 124: Exploring Recursion in Python With Al Sweigart
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.