I have the following loop structure and also the problem, that it is not possible to increment a variable inside of this code due to UnboundLocalError:
while True:
def function_1():
def function_2():
x += 1
print(x)
function_2()
function_1()
My solution was now this one:
x = 0
while True:
def function_1():
def function_2():
global x
x += 1
print(x)
function_2()
function_1()
Is there another solution without global?