Lesson map
Lesson 11. Map, example, EX057.
flowchart TD
M["Three mail rows, written order"] --> S["Membership in the valid set"]
S --> H["Two tuples, mail order"]
H --> Q{"Did the shared-list order win?"}
Q -->|No| K["vol-07 then office"]
The set answers yes or no. The mail list chooses the sequence.
Logical drawing
mail order
vol-07, donate-elmfield.example
vol-12, news.example
office, elmfield-giftaid.example
printed hits
vol-07 then office
not a sort key
the order of shared
Learning outcomes
After this chapter, you should be able to:
- Read the hit list as mail order.
- Say what the set is used for.
- Refuse a hit line that starts with the office.
11.1 Membership does not reorder. The comprehension walks mail.
The hit line keeps a mail row when its domain or address is a member of the set of valid values. A set has no order, so it cannot be the sequence of the result. The comprehension walks mail from top to bottom. vol-07 is first and matches, vol-12 is second and does not match, and office is third and matches. The printed list is therefore vol-07, then office. news.example never becomes a tuple in that list.
shared listed the GREEN domain first and the AMBER domain later. That writing order is not the hit order, even though both names match. Swapping the hit tuples to follow shared would be a different list. The print uses Python's representation of a list of tuples, with single quotes and the parentheses. Those marks are the representation, not extra evidence.
Lesson table; scroll horizontally to read all columns →
| Choice | Source |
|---|---|
| Which rows qualify | Set membership |
| Which qualified row prints first | Position in mail |
| Whether vol-12 appears | It does not qualify |
| Shared-list order | Not the hit sequence |
11.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Offered order | Why it is or is not the print | Decision |
|---|---|---|
| vol-07 then office | Mail order, with the miss skipped | Keep |
| Both qualifying names present | Their rows matched | Keep |
| "Office first, because AMBER is more sensitive." | No severity sort | Refuse |
| "The hits follow the shared list." | The walk is mail |
Refuse |
Synthetic case. The hit list has two tuples.
Errors and limits
Do not let a label's seriousness reorder the mail walk.
Apply
- EX057 — Hit order. The print lists vol-07 and then office. Does that order come from
shared, and where isnews.example?Show marking criteria
Rubric: 3 = the order is the mail list; the set only tests membership; news.example is a mail row that does not qualify; do not sort by label;; 2 = mail order, and the third row is not a hit;; 1 = one tuple;; 0 = none.