E
Edward C. Jones
#! /usr/bin/env python
"""
When I run the following program I get the error message:
UnboundLocalError: local variable 'x' referenced before assignment
Can "inner" change the value of a variable defined in "outer"? Where
is this explained in the docs?
"""
def outer():
def inner():
x = x + 1
x = 3
inner()
print x
outer()
"""
When I run the following program I get the error message:
UnboundLocalError: local variable 'x' referenced before assignment
Can "inner" change the value of a variable defined in "outer"? Where
is this explained in the docs?
"""
def outer():
def inner():
x = x + 1
x = 3
inner()
print x
outer()