What programming actually is
Let's start from absolute zero — no jargon, nothing assumed. By the end of this single page you will know what a computer fundamentally does, what a "program" really is, how the readable text you type becomes something a machine can run, and you will have traced a small working program of your own. You do not need anything outside this page. Read slowly; every new word is defined the first time it shows up.
The machine itself
A computer is built around two parts you should picture. The CPU (short for Central Processing Unit, also just called the "processor") is the part that does things — it follows instructions, one at a time, incredibly fast. The memory is where the computer stores values while it works — numbers, words, anything it needs to remember for a moment. That is genuinely most of it: a tireless worker that follows steps in order, and a giant set of labelled boxes to keep things in.
:::note An everyday analogy Imagine a cook in a kitchen following a recipe card. The cook is the CPU — they read one line of the recipe, do that single action, then move to the next line. The countertop, where ingredients and half-made dishes sit while the cook works, is the memory. The recipe card is the program. The cook never skips ahead, never improvises, and never guesses — they do exactly what the card says, in the order it says. :::
That recipe card is the key idea. A program is just a list of instructions that a computer follows: do this, then this, then this. The catch is that a computer follows the list exactly and literally, with zero common sense. If a recipe says "add salt" but never says how much, a human guesses; a computer either does precisely what you wrote or stops with an error. That strictness feels harsh at first, but it is also a gift: once you learn the rules, the machine becomes completely predictable.
:::tip The one idea to carry through every lesson The computer does nothing you didn't tell it, in the exact order you wrote it, with no common sense. Almost every beginner bug is the computer doing precisely what you said — just not what you meant. :::
From readable code to something the CPU runs
The instructions you write are called source code (or just "code"). Source code is plain text that a human types — words and symbols you can read, like the sentences on this page. But here is the twist: the CPU does not actually understand words like print. Deep down it only understands machine code — raw numbers represented as electrical on/off signals (think tiny switches flipped on or off). Machine code is the only language the processor truly speaks, and it is unreadable to humans. So there is always a gap to cross: from the readable source code you write, down to the machine code the CPU runs.
Something has to translate across that gap. There are two common ways this happens:
- Interpreter = a live translator. Picture a speaker giving a talk in a language you don't know, with a translator beside them speaking each sentence out loud, one line at a time, as it is said. An interpreter reads your source code and runs it line by line, on the spot. Nothing is prepared in advance.
- Compiler = translate the whole book first. A compiler takes your entire program ahead of time, translates all of it into a machine-ready file, and hands you that file to run later — like translating a whole book into another language before anyone reads a word of it.
Python — the language this guide teaches — is interpreted. You hand Python your file and it simply runs it, working through your code top to bottom, one statement at a time. (Languages like C are compiled instead.) You don't need the deep details now; just hold onto this: with Python, your readable text is run in order, line after line, starting at the top.
Statements, and your first program
Let's name the unit Python runs. A statement is one complete instruction — typically one line of code that tells the computer to do one thing. Python runs your statements strictly in the order they appear. Here is the smallest real program; read it like a sentence, don't worry about every symbol yet.
print("Hello, world!")
# output: Hello, world!
That single statement is a complete program. print is a built-in instruction (a function — a named action you can call) that means "display this on the screen." The thing you want shown goes inside the parentheses (...). Because we want to show literal text, we wrap it in quotes: text wrapped in quotes is called a string (just a piece of text, like a string of letters beaded together). Running this prints Hello, world! and stops.
print shows whatever you give it. A few quick examples — the # output comment under each shows exactly what appears on screen:
print("Good morning") # Good morning
print(7) # 7 (numbers need no quotes)
print(2 + 3) # 5 (Python does the math first, then prints the result)
print("2 + 3") # 2 + 3 (in quotes it is just text, so it is shown as-is)
Notice the last two lines: 2 + 3 without quotes is a calculation that prints 5, but "2 + 3" with quotes is plain text and prints the characters 2 + 3. The quotes change the meaning completely — a perfect example of how literal the computer is.
Order matters
Because statements run in order, order matters. The same lines in a different sequence can give a different result. Watch:
price = 10
price = price + 5 # now price is 15
print(price) # 15
Now reorder it so we print before the change happens:
price = 10
print(price) # 10 (printed before the +5 line runs)
price = price + 5 # this happens, but too late to affect the print above
Same three lines, different order, different output (15 versus 10). The computer only knows what has happened so far when it reaches a line — it cannot use a value that hasn't been set yet.
Comments: notes the computer ignores
One more essential tool: the comment. Anything on a line after a # is a note for humans — the computer ignores it completely.
# This whole line is a note. The computer skips it.
print("Hi") # a comment can also sit after code on the same line
# output: Hi
Comments never change what a program does. They exist to explain why you wrote something, so you (and others) can understand it later.
The most important mindset
Now the most important mindset, stated plainly: the computer is literal and has no common sense. It does exactly what you wrote, not what you were thinking. Suppose you mean to greet a user but slip up:
name = "Ada"
print("Hello, name") # Hello, name (NOT "Hello, Ada")
You meant "show the value stored in name." But you wrote name inside quotes, so the computer treated it as plain text and printed the literal word name. It did what you said, not what you meant. (Removing the quotes — print("Hello,", name) — would print Hello, Ada.) Training yourself to read code as literally as the machine does is most of what "learning to program" really means.
What if you break the language's rules — for example, forget a closing quote or parenthesis? Every language has a syntax: its grammar, the rules for how the symbols must be arranged. When you violate that grammar, Python refuses to run and reports a SyntaxError — its way of saying "this isn't valid grammar; I can't read it." Errors are normal and helpful, not a sign you failed; a whole later lesson is devoted to reading them. For now, just know the word.
Putting it together: trace a real program
In practice you type code into a file. Python files end in .py — for example greet.py. You save your statements there, then "run the file," and Python executes each line top to bottom. That is the whole loop: write text into a file, run the file, see what it does, adjust, repeat. Here is your first real program — a few lines that work together:
# greet.py — a tiny first program
name = "Ada" # store the text "Ada" in a box labelled name
greeting = "Hello, " + name # glue two strings together into one
print(greeting) # show the result on screen
# output: Hello, Ada
Let's trace it the way the CPU does, one statement at a time:
- Line 1 is a comment — Python reads it, sees the
#, and skips it. - Line 2 puts the string
"Ada"into memory under the namename. (Storing a value under a name is called a variable — the next lesson's topic.) - Line 3 joins
"Hello, "and the value ofnamewith+, producing"Hello, Ada", and stores that undergreeting. (Using+on two strings sticks them end to end.) - Line 4 prints whatever is in
greeting, so the screen showsHello, Ada, and the program ends.
Four lines, run strictly in order, each one building on what came before. That orderly, literal, step-by-step march is the entire essence of how code runs.
Why it matters
That's the foundation: a CPU follows statements one at a time and memory holds values; source code is readable text humans write, which an interpreter (Python) or a compiler turns into machine code; statements run top to bottom so order matters; print shows things, # marks notes the computer ignores, and the machine obeys literally with no common sense. The next lessons hand you the vocabulary to actually say useful things — variables and types (storing values), decisions (choosing between paths), loops (doing something many times), functions (naming reusable steps), and collections (lists, dicts, strings). You already understand the hardest part — the mindset. The rest is just words for ideas you'll quickly find natural.
Where this leads: once you can write programs, the next rung is comparing how fast they run, the data-structure patterns, and interview prep. See Where this leads next.
Checkpoint
What programming actually is
Pass to unlock the Next button belowNext: Variables and types →