Lesson map
Lesson 14. Map, example, EX060.
flowchart TD
D["Five Booleans in insertion order"] --> M["x when true, space when false"]
M --> S["Sum of the true values is 4"]
S --> Q{"Does the script print 4 of 5?"}
Q -->|No| K["Leave 4 of 5 as a label beside the lines"]
The fraction is arithmetic. The page shows brackets.
Logical drawing
[x] official source used
[x] hash matches vendor
[x] backup taken
[x] tested on staging copy
[ ] admin accounts use MFA
true values: 4 keys: 5 printed fraction: none
Learning outcomes
After this chapter, you should be able to:
- Count the true values without replacing the print.
- Explain the bracket as a one-character flag.
- Keep dictionary order distinct from importance.
14.1 Insertion order prints five lines. The sum is not one of them.
checks is a dictionary of five strings to Booleans. Python 3.7 and later preserve insertion order. This file does not sort the keys. The loop prints [x] when the Boolean is true and [ ] when it is false, then the key. Four values are True. One is False. Someone may write "four true, five keys" in the margin. The loop's own page never contains that fraction, a slash form, or a percentage.
The false key is last because it was written last, not because multi-factor sign-in was judged the least important. Moving that key to the top of the dictionary would move its blank bracket. The published file does not move it. A quality, a duration, or a witness cannot be stored in a Boolean. The x does not say how the hash was obtained, and the blank does not name a person.
Decan et al. (2018) study vulnerabilities across a package network. Their counts are not these five Booleans. SSDF (NIST SP 800-218) groups secure-development practices. This dictionary is not a scored SSDF assessment. OWASP ASVS is likewise not scored. The five lines remain five lines.
Lesson table; scroll horizontally to read all columns →
| Key, in written order | Boolean | Bracket |
|---|---|---|
| official source used | True | x |
| hash matches vendor | True | x |
| backup taken | True | x |
| tested on staging copy | True | x |
| admin accounts use MFA | False | space |
14.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Offered summary | Relation to the print | Decision |
|---|---|---|
Four x brackets and one blank |
The five Booleans | Keep |
| "4 of 5" written beside the lines and marked as a count | Not a line the script prints | May stay if labelled |
"The script's last line is 4 of 5." |
The last line is the blank MFA bracket | Refuse |
| "The blank is last because it matters least." | It is last because of insertion order | Refuse |
Synthetic case. The five keys are the whole checklist.
Errors and limits
Label derived counts as counts. Do not slide them into the output.
Apply
- EX060 — Beside, not instead. Someone replaces the five bracket lines with the single sentence
4 of 5and says the blank is last because it is the least important check. What may a count do, and why is the blank last?Show marking criteria
Rubric: 3 = 4 true values out of 5 keys may be labelled beside the print; the script does not print that fraction; the blank is last by insertion order; the five lines stay;; 2 = the brackets stay and the fraction is not the output;; 1 = one line;; 0 = none.