A function reads a global variable and then changes it, without using global. count = 0 def tick(): print("tick", count) count += 1 tick() What happens when the program runs?
global
UnboundLocalError
tick 0
tick 1
Log in to join the discussion.
Loading…