标签: python variables syntax-error variable-assignment
win=0 def fun(): win+=1 print(win) a = 0 while True: if a == 0: fun()
答案 0 :(得分:0)
您需要在函数内部将变量引用为全局变量,否则它将假定它是局部变量:
def fun(): global win win+=1