Lists & Tables

A track of P40 · Data & Types Basics.

Lists for word collections and dictionaries for tallies — the two containers behind almost every automation.

So far every value you have met stood alone — one number, one phrase. But the tasks worth automating almost never involve one thing: they involve a column of terms to alphabetise, or a tally of how often each word appears. This track introduces the two containers that hold many things at once, and they are the last pieces of vocabulary you need before the automation block.

Think of the last time you alphabetised a glossary by hand — forty terms, pencil hopping up and down the page, the small dread of discovering Begriff after you had already inked in the B section. In this track that entire afternoon ritual becomes sorted(terms): one word, one line, done before your hand reaches the keyboard's last key. And the tally you keep with tick marks — a stroke under each word every time it reappears, an hour of careful counting that one missed stroke quietly ruins? There is a container whose whole purpose is to be that tally sheet, except it never loses count and never gets tired. What would you do with the hour it gives you back? That is not a rhetorical question; the capstone track asks it for real.

The two containers are the list and the dictionary. The list is the column: a row of items in order, which you can count, sort, and pick from — first module. The dictionary is the tally sheet, and more: each entry pairs a key with a value — a word with its count, a term with its translation — and looking one up is instant whether the table holds ten entries or ten thousand. Your paper tally is already a dictionary; the second module just teaches you its curly-bracket spelling.

It is worth saying plainly why these two get their own track: nearly every automation you will ever write — including everything in the capstone, and a surprising amount of what the grown-up disciplines on this platform do — is, underneath, just these two shapes being filled and read. A loop walks a list; a dictionary remembers what it saw. Learn the containers now, in your own material, and the machinery of the next pillar will feel like it was built for you.

On papera column and a tallyThe listyour column, as codeThe dictionaryyour tally sheet, as codeOne-line movessort, count, look up
Two paper habits become two code shapes - and their slow steps become one-liners.