Strings
Strings are a basic primitive in Python; we've used them in nearly every example we've discussed so far. All they do is represent an immutable sequence of characters. Of course, "character" is a bit of an ambiguous word; can Python strings represent sequences of accented characters? Chinese characters? What about Greek, Cyrillic, or Farsi?
In Python 3, the answer is yes. Python strings are all represented in Unicode, a special character definition that can represent virtually any character in any language on the planet. This is done seamlessly, for the most part. For now, let's think of Python 3 strings as an immutable sequence of Unicode characters.
So what can we do with this immutable sequence? We've touched on many of the ways they can be manipulated in previous examples, but let's quickly cover it all in one place: a crash course in string theory!
String manipulation
As you know, strings can be created in Python by wrapping a sequence of characters in single or double quotes. Multi...