I am writing a program where I have a value that is 0 at the start, but is used throughout the program to keep track of "changes" and I want then to print the sum of the changes, the rest of the code works fine but for some reason that variable that goes into multiple functions doesn't keep the changes and return them when I print but just returns 0 every time
var = 0
def func1(var1):
for i in range(x):
for j in range(y):
if condition:
pass
elif condition:
func2(var1)
return var1
def func2(var2):
if condition:
pass
elif condition:
var2 += 1
return var2
func1(var)
print(var)