Good place to stop if you're short on time — step 3 picks up here.
Lesson idea Tap to fold
Which string method removes spaces from the beginning and end?
Show the answer
strip().
Retrieve facts by meaning, not position
A dictionary groups labelled facts about one record. Braces contain key: value pairs separated by commas. Here the keys are quoted strings; values can be text, integers or booleans. This lets one record carry different types without relying on list positions.
shot["frames"] asks for the value with the exact key frames. Reordering pairs does not change that lookup. Missing or differently spelled keys raise KeyError; that is useful evidence of a contract mismatch, not a reason to invent zero. False is a boolean; "False" is nonempty text.
# Store one record with explicit value types.
shot = {"name": "Harbour Dawn", "frames": 96,
"approved": True}
# Retrieve the named facts for the report.
print(shot["name"])
print(shot["frames"])
print(shot["approved"])The three lines are Harbour Dawn, 96 and True. The record stores an integer count and a boolean approval, even though print displays them as text.
Read by key, update the stored frame value, fill the record scaffold, then create a different complete record. Keep the report tied to the dictionary.
Predict, explain, then test
These three brief checks are self-reviewed, not a scored quiz. Explain your answer before opening the comparison. Coding checks test the stated data contract on unfamiliar inputs.
Read a record
In {"frames": 0, "approved": False}, which value does record["frames"] retrieve?
Compare your answer · self-reviewed
The integer zero. It is not the first item by position; the quoted key chooses the value.
Distinguish types
Why is "False" not interchangeable with False?
Compare your answer · self-reviewed
The quoted version is a nonempty string, not a boolean. It may print similarly but behaves differently in a condition.
Diagnose a lookup
Why does shot["frame"] fail when the record contains "frames"?
Compare your answer · self-reviewed
The exact key is different, so Python raises KeyError. Repair the key; do not invent a zero value to hide the mismatch.
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.