CoursePython from Scratch to Intermediate · Module 3: Strings and Text · part 24 of 75
Part 24 · Module 3: Strings and Text

Lab: Clean Tom's notebook and print a slip

10 min read·14 Oct 2026
Module 3 · Lab · About 45 minutes · Needs: lessons 1 to 3 of this module, and Module 2 (comparisons, int(), print)

What you are building

Tom's notebook 12 lines 3 lines fixed 4, 5 and 6 1 set aside line 8, for Amira 1 dropped line 11, a copy 10 clean lines checked by counting report and loan slip
The lab turns Tom's 12 lines into 10 clean ones: three faults fixed (green), one line set aside for Amira to decide (amber), one copy dropped (grey), then a report and a slip.

Amira's question for this module is "Can you read Tom's notebook?" The three lessons each cleaned one or two lines. This lab cleans the whole notebook in one notebook session, using only what you have learnt: slices, string methods and f-strings. There are no loops yet (Module 4) and no files yet (Module 8), so every step works on the notebook as one long string.

Of the twelve lines, three have faults that text tools can fix: the short date on line 4, Frankenstien on line 5 and lena on line 6. Two cannot be fixed by text alone. Line 8 says Kidnapped came back before it went out, which only Amira can settle, so you set it aside. Line 11 is a copy of line 7, so you drop it. That leaves ten clean lines, a lined-up cleaning report and a loan slip for Ben's Frankenstein.

Open a new Colab notebook, call it module-03-lab.ipynb, and run each cell in order.

The rest of this part opens with an account

Signing up is free and takes one email. Nothing to pay, and nothing renews.