<a id="ch-11"></a>

## Chapter 11 — Hits follow the mail list

<!-- open-cyber-academy:lesson-figures:start ch-11 -->
### Lesson map

Lesson 11. Map, example, EX057.

```mermaid
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

```text
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
```
<!-- open-cyber-academy:lesson-figures:end ch-11 -->

### Learning outcomes

After this chapter, you should be able to:

1. Read the hit list as mail order.
2. Say what the set is used for.
3. 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.

| 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

| 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 is `news.example`? *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.

<!-- open-cyber-academy:chapter-navigation:start ch-11 -->
### Continue studying — lesson 11 (chapter 11 of 20)

[← Chapter 10](#ch-10) · [Course chapter index](../SUBJECTS.md) · [Chapter 12 →](#ch-12)

Continue to the next authored lesson.
<!-- open-cyber-academy:chapter-navigation:end -->

## Worked answers

<a id="answer-ex057"></a>
**EX057.** 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.
