Lab: Answer what is out and who has it
Module 5 · Lab · About 50 minutes · Needs: lessons 1 to 4 of this module, and Module 4 (forloops,if, shelf days)
What you are building
Amira's question for this module is "What is out, and who has it?" Each lesson answered a piece of it with a small slice of the data. This lab answers all of it for the whole shelf, in one notebook session, using only what this module taught: lists, tuples, sets, dictionaries, nested data and comprehensions.
You start from three collections: the catalogue of 24 books, the 6 members and the 40 loans. You turn the loans into dictionaries, build lookups from them, and then answer four questions: which loans are out, how many copies are left on the shelf, who has what, and how the shelf divides by genre. The lab ends with a report Amira can read at the counter, checked against the course's known answers.
Open a new Colab notebook, call it module-05-lab.ipynb, and run each cell in order.