Lesson map
Lesson 14. Map, example, EX060.
flowchart TD
R["Three mail rows"] --> H["Two hit tuples"]
R --> M["vol-12 with news.example"]
M --> Q{"Does the script print a MISS line?"}
Q -->|No| K["Omission is the result"]
Three rows were written. Two qualified. The third stays in the source and off the hit list.
Logical drawing
written in mail
vol-07
vol-12
office
printed under hits
vol-07
office
no line
MISS: vol-12
Learning outcomes
After this chapter, you should be able to:
- Count the mail rows and the hit tuples.
- Name the omitted row.
- Refuse a MISS line the script does not print.
14.1 The comprehension drops a non-member. It does not announce the drop.
mail has three pairs. The comprehension keeps a pair only when the second field is in the valid set. news.example is not in that set, so vol-12 contributes nothing to hits. The printed list has two tuples. There is no third print that says the row was checked and missed. Absence from hits is the only trace of that check.
vol-12 remains in the source list. Deleting the tuple to make the source "match the print" would destroy the evidence of a non-match. Adding MISS: vol-12 would claim a column the file does not have. The row is also not a lookalike of a listed domain. It is a different name, news.example, and the equality test rejects it cleanly.
The two labs stay apart here as well. lab_sources.py never sees vol-12, and lab_rapid.py never sees the coordinator inbox. A sentence that puts vol-12 on the source-dependency print has welded two files.
Lesson table; scroll horizontally to read all columns →
| Row | In hits? |
|---|---|
| vol-07, listed domain | Yes |
vol-12, news.example |
No, and no MISS line |
| office, AMBER domain | Yes |
| An invented miss column | Not in the file |
14.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Offered edit | Effect | Decision |
|---|---|---|
| "Leave vol-12 in the source and off the hit list." | The comprehension | Keep |
| "Do not print MISS." | No such label | Keep |
| "Delete vol-12 so the file shows only hits." | Loses the non-match | Refuse |
| "The source lab also listed vol-12." | Different script | Refuse |
Synthetic case. vol-12 is a label in a three-row list.
Errors and limits
Do not fill the silence with a miss column.
Apply
- EX060 — Omitted row. What happened to vol-12, and does either lab print a MISS line?
Show marking criteria
Rubric: 3 = vol-12 stays in mail with news.example; it is absent from hits because the value is not valid; neither script prints MISS; do not delete the row;; 2 = the row is a non-match and no MISS line exists;; 1 = the label only;; 0 = none.