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

## Chapter 5 — The component print is list order

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

Lesson 05. Map, example, EX051.

```mermaid
flowchart TD
  L["Four tuples, written order"] --> P["One pass, no sort"]
  P --> O["Four lines in that same order"]
  O --> Q{"Was the first line chosen by severity?"}
  Q -->|No| K["Keep the embedded print"]
```

The loop follows the list. It does not rank the rows.

### Logical drawing

```text
donate-form     3.2.0  UPDATE to 3.2.4
event-calendar  1.4.1  UNMAINTAINED (1606 days since release)
photo-gallery   2.0.0  REMOVE (not in use)
newsletter      5.1.3  ok
```
<!-- open-cyber-academy:lesson-figures:end ch-05 -->

### Learning outcomes

After this chapter, you should be able to:

1. Name the list the component script walks.
2. Separate that written order from an advisory ranking.
3. Refuse a note that reorders or drops a line.

### 5.1 One pass, and the format widths are not a ranking.

`lab_deps.py` stores four tuples. The comment names the fields: component name, version, a fixed version or `None`, the last release date, and whether the component is in use. The `for` loop unpacks those tuples in the order the list was written. Nothing in the file calls `sort`, `sorted`, or `min`.

The print format is `{name:15} {ver:6}` and then the notes. Width 15 and width 6 pad short strings with spaces. They do not encode severity. `donate-form` is first because it is the first tuple, even though a reader might think an advisory should outrank a stale calendar. `newsletter` is last because it is the last tuple, and its line still appears when the note list is empty.

A later decision to update, replace, or remove a component is a sentence in the change log. It does not delete a tuple. A print that started with `event-calendar` would be a different list.

| What the loop uses | What it does not use |
|---|---|
| Position in `components` | A severity score |
| The five fields of that tuple | Files inside a plugin directory |
| Format widths 15 and 6 | A second ordering key |

### 5.2 Worked example

| Offered result | What produced it | Decision |
|---|---|---|
| Four lines, donate-form first | List order, one pass | Keep |
| The calendar line still present | Its tuple was not deleted | Keep |
| "The script sorted by advisory." | No sort is called | Refuse |
| "Newsletter was dropped because it is fine." | The fourth tuple is still printed | Refuse |

> **Synthetic case.** These four tuples are the only component output.

### Errors and limits

Do not rebuild the list so that it matches a later change log.

### Apply

- **EX051 — List order.** The print names donate-form, then event-calendar, then photo-gallery, then newsletter. May a severity ranking, or a later decision to update or remove one of them, replace that order? *Rubric:* 3 = no; the four tuples stay in written order; the format widths are padding; do not sort the script;; 2 = the four lines stay and the later decision stays prose;; 1 = one line;; 0 = none.

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

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

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

## Worked answers

<a id="answer-ex051"></a>
**EX051.** No. The four tuples stay in written order. donate-form is first because it is first. Format widths only pad. A later decision stays in the change log.
