Variable in loop on Python don't change [duplicate]
Solution 1:
In order to change the a
when iterating i
, you must assign the value to the variable.
so instead of
for a in i:
a*2
print(a)
try
for a in i:
a = a*2
print(a)
In order to change the a
when iterating i
, you must assign the value to the variable.
so instead of
for a in i:
a*2
print(a)
try
for a in i:
a = a*2
print(a)