Python stores strings as an immutable sequence of characters—a jargon-filled way of saying that “it is a collection of characters that, once set, cannot be changed without creating a new string.” Sequences are important in Python. There are three primary types, of which strings are one, and they share some properties. Mutability makes a lot of sense when you learn about lists in the next section.
As you saw in the previous example, you can assign a value to strings in Python with just an equal sign, like this:
>>> mystring = 'hello';>>> myotherstring = "goodbye";>>> mystring'hello'>>> myotherstring;'goodbye'>>> test = "Are you really Bill O'Reilly?">>> test"Are you really Bill O'Reilly?"
The first example encapsulates the string ...