Level 0 · Base Camp

Setting Up Your Lab 🔧

Ten minutes of setup buys you the real thing: Python on your own machine, an editor that helps you, and a folder that is yours.

You can skip this. For now.

Every example in Levels 1 and 2 runs in your browser with the ▶ button, and the Playground is a full editor with nothing to install. If you want to start learning in the next thirty seconds, go, and come back here when a lesson needs real files.

But do come back. Programming on your own machine, with your own files, is the moment this stops being a course and starts being a craft.

Step 1: get Python

The full walkthrough for each operating system, with screenshots' worth of detail, lives on the Setup Lab page. The short version:

SystemDo thisThen check
WindowsInstall from python.org/downloads and tick 'Add python.exe to PATH' on the first screenpython --version
macOSInstall from python.org/downloads (the version Apple ships is old and not for your projects)python3 --version
LinuxIt is almost certainly already therepython3 --version

You are looking for something like this:

$ python3 --version
Python 3.13.5

Anything 3.11 or newer is fine for this course. If you get "command not found", the Setup Lab has a section for exactly that, and it is nearly always the PATH checkbox on Windows.

⚠️ python versus python3

On macOS and Linux, type python3. Plain python may not exist, or may point at something ancient. On Windows, plain python is correct. This course writes python3 and you should mentally drop the 3 if you are on Windows.

Step 2: get an editor

You can write Python in Notepad. You should not. A real editor gives you syntax colouring, tells you about mistakes as you type, and lets you run code without leaving the window.

Take VS Code if you have no opinion. You can change later; nobody will mind.

Step 3: your first real program

  1. Make a folder. In your terminal:
    cd ~
    mkdir python-school
    cd python-school
  2. Open it in your editor. In VS Code: File, Open Folder, pick python-school. Working with a folder open rather than a lone file is the habit that makes everything else work later.
  3. Make a file called hello.py and type this into it. Type it, do not paste it. Your fingers learn things your eyes do not.
    name = "Guybrush Threepwood"
    print("Hello, world!")
    print(f"My name is {name} and I am a mighty programmer.")
    Hello, world!
    My name is Guybrush Threepwood and I am a mighty programmer.
  4. Save it. Ctrl+S, or Cmd+S on a Mac. An unsaved file is why your change "did nothing".
  5. Run it from the terminal, standing in that folder:
    $ python3 hello.py
    Hello, world!
    My name is Guybrush Threepwood and I am a mighty programmer.
VOLITION[Formidable: Success]

That was it. That was the wall. Almost everyone who quits programming quits somewhere in the last five minutes: the install, the PATH, the folder, the 'command not found'. You are past it. Everything after this is just learning what to type.

What you actually installed

Three things arrived on your machine, and knowing which is which will save you later:

ThingWhat it isYou use it by
python3The interpreter: the program that runs your programspython3 myfile.py
pipThe package installer: fetches other people's code from PyPIpip install requests (Lesson 26)
The REPLAn interactive prompt for trying things one line at a timetyping python3 with no filename

Try the third one now. Type python3 on its own:

>>> 2 + 2
4
>>> "Guybrush" * 3
'GuybrushGuybrushGuybrush'
>>> len("How appropriate. You fight like a cow.")
38
>>> exit()

That is the REPL: Read, Evaluate, Print, Loop. It is a calculator that speaks Python and it is the single best tool for answering "wait, what does this do?". Professionals keep one open all day. exit() leaves.

📁 One folder per project, always

Do not pile everything into Documents. Make a folder per project, keep its code in it, and open that folder in your editor. When Lesson 26 introduces virtual environments, this habit is what makes them painless instead of mysterious.

If something went wrong

MessageWhat it meansFix
command not found: python3The shell cannot find PythonReinstall, ticking 'Add to PATH'. Close and reopen the terminal afterwards
No such file or directory: 'hello.py'You are in the wrong folderls to look, cd to move. See Base Camp 5
SyntaxErrorA typo in your codeRead the line number it gives you, then the line above it. Lesson 10 makes this easy
IndentationErrorStray spaces at the start of a lineLine up your code at the left margin unless it is inside a block

The full troubleshooting list, per operating system, is on the Setup Lab page. Nothing you can hit here is unusual, and nothing is your fault.

Exercise 1

Make it yours

Change hello.py so it prints your own name, and add a third line that prints how many years you have wanted to learn this. Run it again.

Reveal solution
name = "your name here"
years = 4
print("Hello, world!")
print(f"My name is {name}.")
print(f"I have wanted to do this for {years} years, which ends today.")
Hello, world!
My name is your name here.
I have wanted to do this for 4 years, which ends today.

If it ran, you have a working lab. Level 1 starts now.

Exercise 2

Live in the REPL for two minutes

Open python3 with no filename and work out, by experiment, what each of these does. Guess first, then run it.

17 // 5
17 % 5
2 ** 10
"ho" * 3
len("Monkey Island")
Reveal solution

17 // 5 is 3 (division, throwing away the remainder). 17 % 5 is 2 (just the remainder). 2 ** 10 is 1024 (2 to the power of 10). "ho" * 3 is 'hohoho' (yes, multiplying text works). len("Monkey Island") is 13, counting the space.

You just learned five things by asking the machine instead of asking a person. That is the most valuable habit in this entire course.

+100 XP