The Nonlocal Keyword
Mon 10 August 2026
def outer():
total = 0
def inner():
nonlocal total
total += 1
Score: 10
Category: chapter1
def outer():
total = 0
def inner():
nonlocal total
total += 1
Score: 10
Category: chapter1