# Closure

say it: **“KLOH-zher”** **/ˈkloʊʒər/**

An inner function that remembers the variables around it.

## What is a **closure**?

A **closure** is an inner function that remembers the variables around it, even after the outer function has finished.

```python
def make_discount(percent):
    def apply(price):
        return price * (1 - percent / 100)   # remembers percent
    return apply

ten_off = make_discount(10)
print(ten_off(50))  # 45.0
```

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

Updated: November 17, 2026

## In other subjects

- [Closure in JavaScript](https://www.ask-codey.com/glossary/closure-javascript)

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