Introduction to Recursion
Learn about recursion and the recursive methods in Python.
We'll cover the following
Repetitions
There are two ways to repeat a set of statements in a function:
- By using a
while
orfor
loop. - By calling the function from within itself.
The first method is known as iteration, and the second is known as recursion.
The functions that use iteration are called iterative functions, and those that use recursion are called recursive functions.
Recursive function
A Python function can be called from within its body. When we do so, it is called a recursive function.
Get hands-on with 1400+ tech skills courses.