append to string in loop without overwriting the previous value

by: Anilt, 9 years ago


Hi,

Is there a way to append the result of something to a string without overwriting the previous value.

Regards
Anil



You must be logged in to post. Please login or register an account.



You can use + or  += to the string in the loop.


x = 'hey'
y = ' there'

print(x+y)

for i in range(10):
    x += ' hi'
    print(x)


-Harrison 9 years ago
Last edited 9 years ago

You must be logged in to post. Please login or register an account.

you can use +? maybe if you post the code we will get a better idea.

-matriXcel 9 years ago

You must be logged in to post. Please login or register an account.