🧩String
Also known as Text String, str
A piece of text in a program. It is written inside quote marks, like "Hello".
Think of it like
Think of it like beads on a thread. Each bead is a letter, and the thread keeps them in order.
Example
A sign-up form keeps the name "Emma Brown" as a string. The site counts 10 characters, space included.
Why it matters
Most of what people type and read is text. Almost every program spends a lot of time with strings.
Definition
Example code
python
>>> name = "Emma" + " " + "Brown"
>>> len(name)
10
>>> name.upper()
'EMMA BROWN'Common mistake
Key takeaways
- 1Text in quotes. Quote marks show where the text starts and ends.
- 2A row of characters. Each letter, digit or space has a place.
- 3Many tools. Join, cut, count and change case.