Lesson map
Lesson 08. Map, example, EX054.
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
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
Learning outcomes
After this chapter, you should be able to:
- State what
usualcontains. - Separate a stored label from a geolocation lookup.
- 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.
Lesson table; scroll horizontally to read all columns →
| 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
Lesson table; scroll horizontally to read all columns →
| 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.
BRandUKare 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
usualcontain, what does the script do withBR, and does it test the routing-service limit?Show marking criteria
Rubric: 3 = the set is{"UK"};BRis not in it, so the country flag is on; the script does not look up a place and does not test routing;; 2 =UKis usual andBRis flagged without a lookup;; 1 = one token;; 0 = none.