Section 1: Getting started
Installing Python and your editor
Let us get Python running on your computer.
Install Python
Go to python.org and download the latest stable version of Python 3 for your operating system. Any version from 3.12 onwards works for this course.
- Windows: run the installer and tick "Add python.exe to PATH" on the first screen. This lets you run Python from the terminal.
- macOS: run the installer package. You will then use the
python3command in the Terminal app. - Linux: Python is usually already installed. Check with
python3 --versionin a terminal, and install a newer version with your package manager if needed.
To confirm the installation, open a terminal (Command Prompt or PowerShell on Windows, Terminal on macOS) and type:
python3 --version
On Windows, the command may be python or py instead of python3. You should see a version number such as Python 3.13.1.
Install a code editor
We use Visual Studio Code, a free editor that works on every system. After installing it, open the Extensions panel and install the Python extension published by Microsoft. It adds colouring, error hints and a run button.
Your first program
- Create a folder called
python-coursesomewhere easy to find. - In VS Code, choose File, Open Folder, and open it.
- Create a new file called
hello.py. - Type this and save:
print("Hello, world")
Click the run button in the top right of the editor. The output appears in the terminal panel at the bottom.
You can also run it yourself from the terminal inside that folder:
python3 hello.py
The interactive shell
If you type python3 on its own, you enter the interactive shell, shown by >>>. Here you can type one line at a time and see the result straight away. It is perfect for quick experiments, like 2 + 3 or "ha" * 3. Type exit() to leave.
Use files for programs you want to keep, and the shell for trying things out.