Episode 5 — The 3-AM Checkout
Programming with Python · Tutorial 05
At 3 AM, on his fourth energy drink, Kevin rewrote the entire checkout “to make it faster.” This morning the health inspector called to announce a surprise visit, and the till is a minefield of crashes. In this notebook you learn to work with things going wrong: read a traceback (Python’s crash report), catch failures with try/except, let your own code refuse bad input with raise, guard invariants with assert, and debug Kevin’s 3-AM checkout line by line. It’s the last lab of Part I. Next session opens with a checkpoint.
Work on the notebook
Open in browser (recommended): runs entirely on your machine, in this tab: no account, no installation, and after it loads no internet is needed.
Your progress lives in this browser tab. If you reload the page (Cmd/Ctrl + R) your work is still there. But if you close the tab and open the link again later, you start from a clean notebook. There is no cross-device sync in the browser, and clearing browser data or private mode also wipes it.
So: download your .py before you leave (menu → Download → Download Python code). That download is the only guaranteed copy. Handing in files works exactly like this in the checkpoints, so you get to practice the motion every week. Note: a downloaded .py is for submission and backup. You can’t upload it back into the browser editor.
Open in molab: marimo’s free cloud (account required). Your copy saves to your account and reopens on any device. Choose this if you know you’ll switch computers or want to be certain nothing is lost. Optional: nothing graded ever requires it.