Everything else is ready: study the parts, the key terms and the quiz below.
- Part 11One review, a list of words
- Part 22Indexing and slicing a string
- Part 33A step, a reversed string, and a palindrome
- Part 44Strings are immutable, so methods return a new string
- Part 55strip, and chaining methods
- Part 66Searching a string: in, find and count
- Part 77replace, split and join
- Part 88A first tokeniser
- Part 99Recap, your challenge, and what's next
Strings
Clean and split text, the first step of every text model.
In this lesson9 parts
- 01One review, a list of words
- 02Indexing and slicing a string
- 03A step, a reversed string, and a palindrome
- 04Strings are immutable, so methods return a new string
- 05strip, and chaining methods
- 06Searching a string: in, find and count
- 07replace, split and join
- 08A first tokeniser
- 09Recap, your challenge, and what's next
Key terms
The words this lesson introduces, each in one line. The module’s glossary collects them all.
- chaining
- Calling a method on the value the previous method returned:
review.strip().lower(). - string
- An immutable sequence of characters, indexed and sliced like a list.
- token
- One of the pieces tokenisation produces. Our tokeniser's tokens are lowercase words without punctuation.
- tokenisation
- Splitting text into pieces. Language models split into subword pieces; the video's tokeniser splits on whitespace.
Quiz 5 questions
Your first pick on each question is the one that counts, and a right one earns a coin. Getting one wrong here is how the lesson sticks.
Practice
Problems to solve in your own notebook. Each states the problem, not the steps: working out the steps is the exercise. Level A applies the lesson, B combines it with earlier ones, C stretches it.
The self-checking notebook for this lesson is Notebook 3 · Strings and Comprehensions.
Common mistakes
What you will see when it goes wrong, why it happens, and the fix.
Where it’s used
Where this lesson’s ideas turn up in real work.