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

## Chapter 8 — The country token is not a lookup

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

Lesson 08. Map, example, EX054.

```mermaid
flowchart TD
  U["usual is the set UK"] --> M{"Is the token in that set?"}
  M -->|Yes| K["No country flag"]
  M -->|No| F["Country flag"]
  A["Approximate country, in prose"] --> Q{"Does the script test that limit?"}
  Q -->|No| S["The token is only a stored label"]
```

Membership is a set test. It is not a map query.

### Logical drawing

```text
usual = {"UK"}
UK -> in the set -> no country flag
BR -> not in the set -> country flag
no network call
no coordinate
no routing-service check
```
<!-- open-cyber-academy:lesson-figures:end ch-08 -->

### Learning outcomes

After this chapter, you should be able to:

1. State what `usual` contains.
2. Separate a stored label from a geolocation lookup.
3. Keep the prose limit outside the script.

### 8.1 Membership uses one set. The script never asks where a packet was.

`usual` is the set `{"UK"}`. The country test is `country not in usual`. A token `UK` is in the set, so the country flag stays off. Elaine's Brazil rows store the letters BR, a miss against that one-member set, and the miss alone keeps the country label. The four UK rows carry `UK`. The test compares strings. It does not call a library, open a socket, or read a map.

Section 2.5 records a human check that is not this loop. Elaine was at home in the UK that weekend, confirmed by phone, because the mailbox might still be controlled. A phone syncing at night would still present `UK`, not `BR`. That reasoning uses the stored label plus a phone call. The script does not place the call.

The errors note in chapter 2 says country information is approximate and can be hidden by services that route traffic. The script does not test that limit. It cannot tell a routed label from a direct one. It also does not print a confidence. `BR` remains the two characters stored in the tuple.

| Input | Script action |
|---|---|
| Token `UK` | No country flag |
| Token `BR` | Country flag |
| Routing-service doubt | Not tested |
| Elaine's phone confirmation | Not a column |

### 8.2 Worked example

| Offered claim | Evidence in the file | Decision |
|---|---|---|
| `UK` is the only usual token | The set has one member | Keep |
| `BR` raises the country flag | It is absent from the set | Keep |
| "The script looked up Brazil." | No lookup is called | Refuse |
| "The script rejected routed traffic." | No such test exists | Refuse |

> **Synthetic case.** `BR` and `UK` are labels in the tuples, not proof of a place.

### Errors and limits

Do not add a geolocation call to make the limit look checked.

### Apply

- **EX054 — Stored label.** What does `usual` contain, what does the script do with `BR`, and does it test the routing-service limit? *Rubric:* 3 = the set is `{"UK"}`; `BR` is not in it, so the country flag is on; the script does not look up a place and does not test routing;; 2 = `UK` is usual and `BR` is flagged without a lookup;; 1 = one token;; 0 = none.

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

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

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

## Worked answers

<a id="answer-ex054"></a>
**EX054.** `usual` is the set `{"UK"}`. `BR` is not in that set, so the country flag is on. The script does not look up a place and does not test routing.
