#Python | why doesn't this string concatenate

1 messages · Page 1 of 1 (latest)

marsh gyro
#

Strings are immutable in python

#

So when you do strval += '0' the strval is now a new object that's not the same as the one referenced by the loop

#

If you want to modify values in a list using a loop, use the indexes instead