Good place to stop if you're short on time — step 3 picks up here.
Lesson idea Tap to fold
What type of value does DictReader store under "frames"?
Show the answer
A string. Use int() when you need a number.
Filter a list of typed records
A list preserves record order; each dictionary labels the facts for one item. The loop variable refers to the current dictionary, not always the first item.
Filtering is a decision for every record. approved is a boolean here, not the strings "True" or "False". For a numeric threshold, decide whether the boundary itself qualifies.
# Filter a list of typed records.
shots = [
{"name": "Museum", "frames": 100},
{"name": "Canal", "frames": 101},
]
for shot in shots:
if shot["frames"] > 100:
print(shot["name"], "·", shot["frames"])
Only Canal · 101 appears. Exactly 100 does not satisfy greater than 100. An empty list has no records to report.
Test none, all and mixed qualifying records, plus the exact boundary. That gives stronger evidence than checking only one familiar result.
Predict, explain, then verify
These brief checks are self-reviewed, not quiz scores. Browser runs use fresh temporary files; they do not open your computer’s files. Download useful reports before another Run, Reset, exercise change or leaving.
Trace a boundary
Which qualifies for frames > 100: 100 or 101?
Compare your answer · self-reviewed
Only 101. > is strict; >= would implement a different rule.
Inspect a type
Why is the string "False" a bad replacement for the boolean False in an approval flag?
Compare your answer · self-reviewed
A nonempty string is truthy, so a simple if would include it.
Check an empty input
How many lines should the filter print for an empty shots list?
Compare your answer · self-reviewed
Zero. The loop has no records to visit.
Choose an exercise to load its prompt.
Loading exercises…
Noted on your route map, with the step you were on. Nothing is lost by parking it — the next review day will bring this idea back, and the flag tells the course where to slow down.
The tutor mounts here when JavaScript is available. The lesson above stays readable without it.