I can't understand why in loop variable don't change, but I explicitly try it. So here is my code:
a=[1,2,3]
b=["a","b","c"]
d=[a,b]
for i in d:
for a in i:
a*2
print(a)
And when I run I see :
1
2
3
a
b
c
Instead expected:
2
4
6
aa
bb
cc
2 * anot aa*2bya=a*2.a*2gets "lost", it doesn't change the value ofa. To do that you'd need to either reassignaits new value by doinga = a * 2or just print the desired value by doingprint a * 2. Also, you are using the variableafor both the array and the inner variable in the second loop. Avoid this at all costs.