以下代码给出了错误UnboundLocalError: local variable 'Var1' referenced before assignment
:
Var1 = 1
Var2 = 0
def function():
if Var2 == 0 and Var1 > 0:
print("Result One")
elif Var2 == 1 and Var1 > 0:
print("Result Two")
elif Var1 < 1:
print("Result Three")
Var1 =- 1
function()
我怎样才能解决这个问题?