remember the term "immutable sequence"as we've seenthe immutable part means that you cannot change string in place--for instanceby assigning to an indexs 'spams[ 'xraises an errortypeerror'strobject does not support item assignment how to modify text information in pythonthento change stringyou generally need to build and assign new string using tools such as concatenation and slicingand thenif desiredassign the result back to the string' original names 'spam!to change stringmake new one 'spamspam! [: 'burgers[- 'spamburger!the first example adds substring at the end of sby concatenation reallyit makes new string and assigns it back to sbut you can think of this as "changingthe original string the second example replaces four characters with six by slicingindexingand concatenating as you'll see in the next sectionyou can achieve similar effects with string method calls like replaces 'splots replace('pl''pamal' 'spamalotlike every operation that yields new string valuestring methods generate new string objects if you want to retain those objectsyou can assign them to variable names generating new string object for each string change is not as inefficient as it may sound--rememberas discussed in the preceding python automatically garbage-collects (reclaims the space ofold unused string objects as you goso newer objects reuse the space held by prior values python is usually more efficient than you might expect finallyit' also possible to build up new text values with string formatting expressions both of the following substitute objects into stringin sense converting the objects to strings and changing the original string according to format specification'that is % % bird!( 'dead'that is dead bird'that is { { bird!format( 'dead''that is dead bird!format expressionall pythons format method in despite the substitution metaphorthoughthe result of formatting is new string objectnot modified one we'll study formatting later in this as we'll findformatting turns out to be more general and useful than this example implies because string fundamentals