I have the following code:
counter = 0
def function_1():
func_2(counter)
def func_2(counter):
func_3(counter)
def func_3(counter):
counter += 1
My goal is to keep track of counter incrementation in func_3()
in all other functions.
I tried to make counter global
counter = 0
def function_1():
global counter
func_2(counter)
def func_2(counter):
func_3(counter)
def func_3(counter):
counter += 1
but it does not work, the counter incrementation is just local to func_3()
Any hints?