In 0.3 you programmed a person and watched them take you literally. Today you do it to a machine that never gets tired of being literal — and you break it on purpose.
A gentle first look at running Python. Skim it — you’ll do the real work here. Enrolled in our Runestone course? Open it from there so your progress counts.
New region: Programs. For three weeks everything was a representation — how the world becomes bits. Now you start telling the machine what to do with them. The bits never went away; they’re underneath every line you write.
Here is the good news buried in that: the computer is not judging you. When your program breaks — and it will, today, on purpose — it is not saying you’re bad at this. It is telling you, very precisely, which instruction it couldn’t follow. Learning to read that message is the whole job. Most people quit programming because they think errors mean failure. You’re going to spend day one proving they mean the opposite.
A program is a list of instructions, run top to bottom, in order. Each
line is a program statement — one thing you’re asking the machine
to do. Your first verb is print: it displays whatever you put in the parentheses.
print("Hello, world!") # displays: Hello, world! print("I am a program.") # the next line runs after the first
Three things are load-bearing there, and every one is a rule the machine enforces exactly:
print acts on — they must open and
close. Spelling counts — print is a word Python knows;
prnt is not.
Anything after a # on a line is a comment — Python ignores
it completely. Comments are notes to humans: the future you, or a partner reading your code. They
change nothing about how the program runs, and they are one of the cheapest good habits in this
whole course.
Three programs, each broken one small way. Hit Run to see exactly what Python says, then Fix to see the one change that makes it work. Read every error message — that is the skill.
Notice the pattern: the error message names the kind of problem and usually points near the line. It is not punishment — it is the most helpful thing a computer ever does for you.
Three words you used today. Now they get names.
# in Python. The machine
ignores it entirely; it exists to make the program understandable.Five questions in AP format. Pick an answer to see feedback immediately.
In 1962, NASA lost the Mariner 1 probe less than five minutes after launch. Investigators traced it, in part, to a tiny mistake in the guidance software — a single missing mark in a formula. The rocket did precisely what the code told it to. It just wasn’t what anyone meant.
That is the double edge of a machine that takes you literally: it will never guess your intention and never quietly fix your typo. Everything good about programming and everything dangerous about it come from the same fact. Which is exactly why the boring habits — run it, read the error, comment your intent, test it — are not busywork. They are how you make sure “what you said” and “what you meant” are the same thing.