Lesson 2: Tuples and sets, fixed records and unique values
16 min read·14 Oct 2026
Module 5 · Lesson 2 · About 45 minutes · Needs: Module 5 Lesson 1 (lists, indexing, slicing,append,len, loops over a list) and Module 1's multiple assignment
The situation
Amira leans on the counter with the twelve loans from Module 4. "What is out, and who has it? I want each name once." Six of the twelve loans have no return day:
Six loans, but five people: Kwame has two. A list keeps every repeat, so counting names in a list gives the wrong answer. This lesson adds a tuple, to hold one loan as a fixed record, and a set, to hold each name once.