I'm trying to writing some codes that defines the outer function including inner function.
def outer():
t = 1
for i in range(3):
print(f'## {i}th loop##')
t = inner(t)
return t
def inner(t):
print(f't value is now {t}')
t += 1
if (t % 10) != 0: # imaginary if-condition to reproduce my original codes
inner(t)
return t
outer()
While doing this, I confronted the problem that implementing inner function few times does not change the variable value that was defined with the definition of outer function at the same time.
The result of codes above is:
In first iter, t : 1,2,3,4,5,6,7,8,9
In second iter, t : 2,3,4,5,6,7,8,9 ..
I expected that the t value in the second iteration will start with the value of 10. Would u let me know what the problem is?