String in Python are immutable (cannot change to allow for optimization of using one dictionary for all strings).
For example:
>>> y="hello"
>>> y.replace("h","m")
'mello'
>>> y
'hello'
When we want to change a string, we can either use bytearray or (often better) - just create a new string. Consider for example the method 'replace'. It did not change the string in the example - but we could assign it's return value.
>>> y1 = y.replace("h","m")
>>> y1
'mello'
Or even use the same variable y, in which case it will create a new string and overwrite the previous value of y.
>>> y = y.replace('h','m')
>>> y
'mello'
Which is just like putting a new value alltogether:
>>> y = 'a new value'
>>> y
a new value