Quiz — Lecture 15
Section A from memory, one line each. Section B shows your reasoning - marks are for method, not final answers. Answers are discussed in class; the exit ticket goes on a card.
Section A
A1. When is a mutable default argument created?
A2. What is the standard fix?
A3. Reassigning a parameter vs mutating it: which does the caller see?
A4. is vs ==: what does each test?
Section B
B1. Fix def add_tag(tag, tags=[]) and explain in one sentence.
B2. Predict the output: def f(x, acc=[]): acc.append(x); return acc - called f(1), f(2).
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- When is the complement trick the right tool?
- Permutations vs combinations in one phrase each.
- How does simulation back up counting?
Homework
- Before: skim the four student pages; attempt case 1 on paper.
- After: write a five-line pseudocode solution for any case you did not
- Enrichment (optional): the stretch question on each case page.