Strings
A string holds text.
Think of it as a locked notebook page.
Once you write it, you cannot erase letters inside.
You make a new string instead.
Creating strings
Use double quotes for normal strings.
Use backticks for raw strings.
Raw strings keep newlines and backslashes exactly as you typed them.
Length and joining
len(s) counts bytes, not always letters.
Use + to join two strings into a new one.
The old strings stay the same. You get a brand new page.
Cutting a piece
s[start:end] cuts out a piece by byte index.
Indexes start at 0.
The end index is not included.
Runes are characters
A rune is one character, like a letter or emoji.
Some characters need more than one byte.
That is why len can surprise you with emoji.
Walking text with range
When you range over a string, each step gives an index and a rune.
That is the safe way to visit each character.
Remember: len counts bytes. range walks characters (runes).
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.