# File: scope3.py # # A failed attempt at altering the value # of n, because n is local in inc(). # def inc(x): n = n + 1 return n n = 3 print(inc(n)) print("n = ", n) ''' Output from the program: Traceback (most recent call last): File "scope3.py", line 7, in print(inc(n)) File "scope3.py", line 3, in inc n = n + 1 UnboundLocalError: local variable 'n' referenced before assignment '''