In Python, a String is an immutable, ordered sequence of Unicode characters enclosed in quotes (`'...'`, `"..."`, or `'''...'''`):
Dual Indexing Architecture
Every character in a string of length $n$ occupies two dual indices:
| Positive Index (Left → Right) | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Character | P | y | t | h | o | n |
| Negative Index (Right → Left) | -6 | -5 | -4 | -3 | -2 | -1 |
String Immutability Proof
Strings cannot be altered in-place. Attempting to modify an indexed character raises a runtime error:
s = "Python"
s[0] = "J" # TypeError: 'str' object does not support item assignment!
# To create a modified string, you must construct a brand-new object:
s = "J" + s[1:] # s is now bound to "Jython"