What is the correct fix?
count = 0
def bump():
count += 1
bump()
- Declare
global countinside the function - Declare
nonlocal countinside the function - Change
count += 1tocount = count + 1 - Move the
count = 0line intobump
Assigning makes
Play Problem Solving ▸
count local; global binds it to the module-level name.