Introduction to Programming

Module 1 · Introduction to Programming · Lesson 1 of 7

How a computer program works

A program is nothing more than a list of instructions. The computer reads them one at a time, from top to bottom, and does exactly what each one says — no guessing, no skipping ahead. Watch this tiny program run: the highlight is the computer's place in the code, and the panel on the right is what it produces.

hello.py
print("Hello!")
print("Welcome to loop")
print("Let's begin")
output
Hello!
Welcome to loop
Let's begin
$

Each line above is a single instruction — print(...), which shows text on screen. The computer runs the first, then the second, then the third, always in that order. It feels instant because a processor runs billions of these steps per second, but the rule never changes: one instruction after another.

Everything else you'll learn — decisions, loops, functions — is just a way of controlling which instructions run and how many times. But underneath, it's always this: a sequence of steps the computer follows faithfully.