In this lesson
- It starts with a question. A function calls itself 100,000 times before reaching the base case. What is likely?
- The idea you will find. Depth costs memory; a loop does not. — Recursion is the clearer expression for nested structures, and a loop is the safer one for long sequences. Choosing between them is a real engineering decision, not a matter of taste — and in Python the depth limit makes it for you at a few thousand.
- Length. 5 short steps. Progress saves on this phone.
Part of Python: Recursion
Solving a problem by solving a smaller copy of it — and always leaving a way out.