University of Free Knowledge
QA 76.73 · fol. 1

A List of Instructions the Machine Obeys

A program is an ordered list of statements the computer carries out exactly, one after another from top to bottom. · 9 min

A program is a list of instructions you write for a computer. The computer does not read ahead, guess your intent, or fix your order. It starts at the first line, finishes it, moves to the next, and keeps going straight down to the last line. That plainness is the point: because the order is fixed, you can know exactly what a program will do before you run it — by reading it the same way the computer does, one line at a time.

Guess before you learn

This program has three lines: print("Good morning.") print("The time is 9.") print("Have a good day.") Which line of text appears first on the screen?

THE DEPTH DIAL — the same idea, younger or deeper
9–12

9–12

A program is an ordered sequence of statements, and the interpreter executes them one at a time in the order they are written, top to bottom. This is the sequential model of execution: after a statement finishes, control passes to the next line, and only to the next line. The three big ideas ahead — decisions, loops, and functions — are all just disciplined ways to change which statement runs next. Until you meet them, every program you read runs in a single straight line, which means reading a program and running a program are the same act performed at different speeds.

statement

One complete instruction, usually on its own line. A program is a list of statements the computer runs in order.

print("Good morning.")print("The time is 9.")print("Have a good day.")
PLATE I Three statements, run top to bottom in one straight line.

Ink That Thinks — guess first; the answer draws itself.
These five steps make a cup of tea — a small algorithm. Drag them into the order a program would carry them out.

  1. Turn on the kettle
  2. Wait for the water to boil
  3. Pour the water over the tea
  4. Wait three minutes
  5. Lift out the tea bag
Reorder, then commit.
PLATE II Order the steps of the algorithm — guess in graphite, truth in ink.
Retrieval Gate — answer before you continue 0 / 4

1.Which sentence best describes a computer program?

2.Put these three statements in the order Python runs them.

  1. print("first")
  2. print("second")
  3. print("third")

3.You swap the first two lines of a working program. What is most likely to happen?

4.In one sentence, explain what it means that a program runs its statements in order.

Because the order is fixed, you can trace a program: read it line by line and write down what each line does. Tracing is how you predict output without running anything, and how you find the exact line where a program goes wrong. One more quiet fact: running the same program again, unchanged, gives the same result. A program is repeatable, not random.

Why is this true?

Why can you predict a program's output just by reading it from top to bottom?

Because statements run in a fixed order — each one finishes before the next begins, and none is skipped. Reading in that same order walks the exact path the computer takes, so the output is knowable in advance.

Trace this program line by line — the steps fade as you master them

1
Line 1 runs first: print("Loading"). What appears on the screen?
Loading
2
Line 2 runs next: print(3 + 4). Python computes 3 + 4, then shows the result. What appears?
7
3
Line 3 runs last: print("Done"). What appears?
Done
STEPLINE THAT RUNSWHAT APPEARS1print("Loading")Loading2print(3 + 4)73print("Done")Done
PLATE III Tracing: read each line in order and write down what it does.
Retrieval Gate — answer before you continue 0 / 4

1.A program's only line is print(2 + 5). What number appears on the screen?

2.A program runs print("A"), then print("B"), then print("A"). What appears, top to bottom?

3.Without looking back: what is a statement, and in what order do a program's statements run?

4.You run the same program twice and change nothing between runs. What should you expect?

Note

Losing track of what runs first? The Atelier of Mind teaches tracing drills that make reading code in order automatic.

Practice — new ink and old, interleaved

1.Which statement is true of every program you have seen so far?

2.What number does print(6 + 6) show?

3.Put these lines in the order they run.

  1. print("one")
  2. print("two")
  3. print("three")

4.Say in your own words what a program is.

The Call Slip — search everything Ctrl·K / ⌘K