OpenCyber Academy
Rapid course · Lesson 5 · English
Course code: OCA-012Lesson 05: OCA-012-A005

The quick-check print is one matrix

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Lesson map

Lesson 05. Map, example, EX051.

flowchart TD
  D["Twelve keys, five cells each"] --> S["Sum each column"]
  D --> A["all of five ones"]
  S --> P["10, 8, 8, 11, 9 out of 12"]
  A --> C["3 of 12; worst FB07"]
  P --> Q{"Is a column rate the all-five count?"}
  C --> Q
  Q -->|No| K["Keep the embedded print"]

One dictionary. Five predicates. Two different summaries.

Logical drawing

updates<=14d   10/12
encrypted       8/12
standard user   8/12
screen lock    11/12
backup<=7d      9/12
laptops passing all five: 3/12; worst: FB07

Learning outcomes

After this chapter, you should be able to:

  1. Read each line of the embedded print as a defined reduction of the same dictionary.
  2. Separate a column total from the count of rows that pass every predicate.
  3. Refuse a note that replaces this run with Friday's update story.

5.1 Five reductions of one dictionary, and no second run.

lab_quickcheck.py stores twelve keys, FB01 through FB12. Each value is a list of five integers, and each integer is only 1 or 0. The list order is fixed by checks: updates within fourteen days, disk encryption, a standard everyday account, a screen lock, and a backup within seven days. The script then does three reductions and nothing else.

The first reduction walks column i and sums it. Because a yes is the integer 1, the sum is a count. Those five counts are the five rates in the print: 10/12, 8/12, 8/12, 11/12, and 9/12. The denominator is len(laptops), which is 12. The front-desk computer is not a key in this dictionary, so it cannot change the denominator.

The second reduction keeps a key only when all(v) is true, that is, when every cell is 1. Three keys qualify: FB01, FB08, and FB12. The print therefore says laptops passing all five: 3/12. A laptop with four yes cells is absent from that count. The column rates can look healthy while the conjunction stays small, and both statements are true of this same object.

The third reduction chooses min(laptops, key=lambda k: sum(laptops[k])). It returns the key whose five cells add to the smallest total. FB07 adds to 1. No other key adds to 1, so this run never has to break a tie. The print's worst: FB07 is that minimum. It is not a judgement written by hand beside the table, and it is not a claim about the laptop's age. Age is a later sentence in the prose.

Chapter 1 then tells a different story about updates. By Friday, the prose says, all twelve laptops show updates within fourteen days. That sentence is not a second execution of the script. The embedded lists still contain a 0 in the updates column for FB03 and for FB07. A reader who pastes 12/12 over the first printed line is reporting a quantity this program did not compute. The same refusal applies to the closing note that twelve of twelve laptops later pass all five. Chapter 4 can narrate a later reading. It does not edit this dictionary.

5.2 Worked example

Lesson table; scroll horizontally to read all columns →

Sentence offered as a result What computed it Decision
encrypted 8/12 Column sum Keep it on this print
laptops passing all five: 3/12 all on each row Keep it on this print
worst: FB07 Minimum of the five-cell sums Keep it
"The script now prints 12 of 12 on every line." No rerun is in the file Refuse

Synthetic case. Fenwick's twelve lists are the only machine output. Friday's update note is prose.

Errors and limits

A column can move in a later week while this embedded file stays as first recorded. Do not repair the print to match the story.

Apply

Worked answers

EX051. No. The dictionary stays. Column sums stay 10, 8, 8, 11 and 9 out of 12. The conjunction stays 3 of 12. FB07 stays the unique minimum. Do not edit the script.