# Recursion

say it: **“rih-KUR-zhun”** **/rɪˈkɜrʒən/**

A function calling itself to solve a smaller piece of the same problem.

## What is **recursion**?

**Recursion** is when a function calls itself to solve a smaller piece of the same problem. It needs a stopping point, or it runs forever.

```python
def countdown(n):
    if n == 0:
        print("Liftoff!")
        return
    print(n)
    countdown(n - 1)

countdown(3)  # 3, 2, 1, Liftoff!
```

Level: Apprentice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=2)

Updated: November 17, 2026

## In other subjects

- [Recursion in C#](https://www.ask-codey.com/glossary/recursion-c-sharp)
- [Recursion in Data Structures](https://www.ask-codey.com/glossary/recursion-data-structures)
- [Recursion in Java](https://www.ask-codey.com/glossary/recursion-java)
- [Recursion in JavaScript](https://www.ask-codey.com/glossary/recursion-javascript)

Source: https://www.ask-codey.com/glossary/recursion
