OpenCyber Academy
Bachelor's · Chapter 3 · English
Course code: OCA-097Chapter 03: OCA-097-C003

Chapter 3 — Programming I

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 03 published. Map, example, EX007.

flowchart TD
  N0["Learning outcomes"]
  N1["3.1 First script"]
  N2["3.2 Filtering"]
  N3["3.3 Actionable output"]
  N4["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4
  N4 --> EX["Worked example"]
  EX --> Q["Exercise EX007"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["3.1 First script"]
  N2["3.2 Filtering"]
  N3["3.3 Actionable output"]
  N4["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> Q["EX007"]
[Learning outcomes]
    |
    v
[3.1 First script]
    |
    v
[3.2 Filtering]
    |
    v
[3.3 Actionable output]
    |
    v
[Synthesis]
    |
    v
[Worked example] --> [Exercise EX007]

Learning outcomes

You will (1) read governance data with simple programs; (2) count and filter records; (3) write output that people can act on.

3.1 First script

Sofia writes her first Python program to read Elmfield's inventory from a CSV file. It prints how many assets exist and how many lack an owner. She learns basic structures: lists to hold records, loops to visit each one and conditions to test fields. Her lecturer stresses that even a simple count helps governance, because it replaces impressions with facts. The script also runs the same way every time, unlike manual counting, which may give different answers on different days. Run again after owners are assigned, the same script shows whether the number of unowned assets has actually fallen.

3.2 Filtering

Next Sofia filters the inventory to list assets that hold tenant personal data and lack an owner. Two appear: the board portal, which stores board papers containing tenant complaints, and a shared drive folder. She prints each with its location so someone can follow up. She learns that filtering by the combination of sensitivity and missing ownership points managers to the most urgent gaps first, rather than overwhelming them with a long undifferentiated list of problems. The board portal comes first because its board papers contain tenant complaints and nobody is responsible for it.

3.3 Actionable output

Dr. Haddad reviews her output. A line saying two problems found is not useful; a line naming the asset, the problem and a suggested owner is. Sofia rewrites the output to include these fields and the date of the run. She learns to think of program output as a message to a busy manager. If the message needs explanation, it should be rewritten. This habit will matter throughout the course when scripts produce governance evidence. A useful line might read: board portal, no owner, suggested owner the company secretary, run on the date shown.

Worked example

Sofia counts inventory records, filters sensitive unowned assets and rewrites output to name asset, problem and suggested owner.

Synthetic case. The inventory file is synthetic.

Errors and limits

Scripts trust their input. Suggested owners need confirmation.

Exercises

Synthesis

Simple programs that count, filter and explain turn governance data into action.

Continue studying — chapter 03 of 40

← Chapter 02 (draft) · Course chapter index · Chapter 04 (draft) →

Worked answers

EX007. It replaces impressions with facts and gives the same answer each run.

EX008. Assets holding tenant personal data that lacked an owner.

EX009. The asset, the problem, a suggested owner and the date of the run.