A three-state walk — marker, header, rows — with blank lines skipped in every state. The exercise is this same page with the stub left empty.
The shape of the answer
| Line looks like | Do |
|---|---|
a marker line — two at-signs then Name |
close the current section (if any), start a new one named Name |
| blank | nothing — a blank line is never a row |
| first non-blank after a marker | the header |
| any other | a row |
The one trap is the last section: the loop ends without seeing another marker line, so the section that is still open has to be added after the loop — the check "Region has two rows" is the one that catches forgetting it.
Live and green
Press Run — the full implementation, the battery all green.
Implement Split for the type-marker sectioned format — a new section at each marker line, the first non-blank line as header, later lines as rows, blank lines ignored, the last section closed after the loop — and show the battery all green.
← Back to the exercise · Lesson 1 — Declared imports · All solutions