← Back to archive

Stdle #39 · scope · 2026-07-15

What does this Python snippet output?

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

def f():
print(str)
str = "x"
try:
f()
except UnboundLocalError as e:
print(type(e).__name__)
Scope
4 attempts left

Answer & explanation