Functions
2 / 20
EasyOutput prediction

Closure captures variable by reference

What does this code print?

def make_adder(n):
    def adder(x):
        return x + n
    return adder

add5 = make_adder(5)
print(add5(3))

← → arrow keys to navigate

Sign in to save your progress.

Closure captures variable by reference - Python Functions Quiz | Unnested