Lab: The late-fee calculator for six loans
Module 2 · Lab · About 45 minutes · Needs: lessons 1 to 4 of this module (numbers, text and None, conversions, input and output)
What you are building
Amira's question for this module was "What does Ben owe if he is 9 days late?" You answered it in Lesson 1 with the 9 written into the code. Now you build the calculator she can use for any loan. It takes the four facts on a loan line as text: the loan id, the member, the borrow day and the return day (blank if the book is still out). It converts them, works out the due day, the days late and the fee in whole pence, capped at 300, and prints one row of a table.
You build it first in notebook cells for Ben's loan L13, then save it as a script and feed it six loans from the shelf: L02, L04, L05, L07, L13 and L23. A check cell then compares the six rows with the right answers. Every loan and person here is simulated. Open a new Colab notebook for the lab and run the cells in order.