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

## Chapter 11 — The corpus is twenty and twenty after the slice

### Learning outcomes

After this chapter, you should be able to:

1. Say why the build loop's 40 rows become 20 before the print.
2. State that every denominator in the four defence lines is 20.
3. Explain the zero in `benign_calls` without adding a row.

### 11.1 The slice keeps ten rows from the front and ten rows from the tail.

For each `i` in `range(20)` the loop appends an invoice row and then either a note or a memo. That is 40 rows, all marked `inj`. The next line is `docs = docs[:10] + docs[30:]`. Indexes 0 through 9 stay. Indexes 30 through 39 stay. Indexes 10 through 29 are dropped. Twenty marked rows remain.

Front plus tail, nothing from the middle.

Those twenty are ten invoice rows, three note rows and seven memo rows. The notes are the passes where `i % 4 == 0` and the index survived the slice: i equals 0, 4 and 16. The memos are the other second-rows that survived. After the slice, twenty strings that begin with Policy are appended and marked ok. The corpus length is 40 again, but the counters do not divide by 40. Each counter filters on the mark and prints `/20`, because each mark occurs 20 times.

`benign_calls` counts `ok` rows that produce a call. A policy sentence does contain the letters ACTION. After `split(". ")` that sentence is one segment, and the segment does not start with `ACTION:`. Every mode therefore reports `benign_calls=0/20`. The zero is not a claim that the word is absent. It is a claim about how the segment test works on this sentence.

| Group | Count used by the print |
|---|---|
| inj rows after the slice | 20 |
| ok policy rows | 20 |
| dropped inj rows | 20, and they are not counted |
| benign calls | 0 on all four lines |

### 11.2 Worked example

| Mistake | Why it is a mistake |
|---|---|
| "The denominator is 40 because the loop ran twenty times two." | The slice runs before the counters |
| "benign_calls is 0 because the policy text lacks the word ACTION." | The word is present; the segment test fails |
| "All four lines use /20." | That matches the print |

> **Synthetic case.** The rows are strings in a list. They are not Tallis mail.

### Errors and limits

This toy's counters are not a measurement of a live mailbox, and the dropped twenty rows leave no trace in the print.

### Apply

- **EX057 — Denominators.** Why is every fraction out of 20, and why is benign_calls zero on all four lines? *Rubric:* 3 = the slice leaves 20 inj rows and 20 policy rows are appended; the policy segment does not start with the marker the parser requires;; 2 = both group sizes;; 1 = "the print says 20";; 0 = uses 40 as the denominator.

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

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

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

## Worked answers

<a id="answer-ex057"></a>
**EX057.** The loop builds 40 inj rows. The slice `[:10] + [30:]` keeps 20 of them, and 20 policy rows are appended. Every printed denominator is 20. A policy segment does not start with `ACTION:`, so benign_calls is 0 on all four lines. The word ACTION can appear without becoming a call.
