local variable referenced before assignment but object python code example
Example: python local variable referenced before assignment
variable = "Hello"
def function():
global variable
print(variable)
function()
variable = "Hello"
def function():
global variable
print(variable)
function()