Getting started

A computer does nothing on its own. It follows instructions, one after another, exactly as written, very fast, and without ever guessing what you meant. Programming is writing those instructions. A finished set of instructions is a program.

That "exactly as written" is the whole difficulty and the whole power. A person told "add up the prices" will cope with a smudged receipt. A computer will not; every step has to be spelled out. In return, once the steps are right, the computer will repeat them a million times without a mistake.

What a programming language is

You cannot write instructions in English, because English is ambiguous and computers cannot cope with ambiguity. A programming language is a small, strict language designed so that every sentence has exactly one meaning. There are many of them. They differ in how they look and what they are good at, but they all do the same job: let a person describe steps precisely enough for a machine to follow.

What Python is

Python is one of those languages. It was designed to be readable, so its instructions look closer to English than most. Here is a complete Python program:

print("Welcome to the shop")
print(40 * 3)

Press Run. The computer followed two instructions: show some text, then multiply two numbers and show the result. You do not need to understand the details yet; the next pages teach them one at a time.

Python is used for websites, data analysis, science, automation, and as the first language taught in many universities. The skills transfer: once you can think in one language, picking up another is weeks, not years.

The computer is literal

Change print in the box above to Print, with a capital P, and run it. You get an error. Python has no instruction called Print, and it will not assume you meant the lowercase one. Most of what beginners experience as "the computer being difficult" is this: it does what you wrote, not what you meant. Reading error messages calmly is a skill you will build from the first page.

How this site works

Every grey box with a Run button is a real Python program running inside your browser. Nothing is installed on your computer and nothing is sent anywhere. You can edit any box and run it again; nothing you do can break anything, and Reset puts the original back.

Lessons end with exercises. You write a small program in a box, press Run tests, and the page checks it. That is where the learning happens: reading is not programming, writing is.

The pages in this section

  1. Why learn to code when AI can write it?
  2. Values and print
  3. Names
  4. How a program runs
  5. Functions

Ready? Start with Why learn to code when AI can write it?, or skip straight to Values and print.