1 2 3 4 5 6 7 8 9 10 11 12
def func(): global x if 'x' not in globals(): x = 0 x += 10 print(x) func() func()
1 2
10 20