← Back to archive

Stdle #70 · scope · 2026-08-15

What does this Python snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

n = 5
def f():
n = n + 1
return n
try:
print(f())
except UnboundLocalError as e:
print(type(e).__name__)
Scope
4 attempts left

Answer & explanation