What You Will Learn
By the end of this lesson, you will have Python installed on your computer and will have run your first Python program.
Step 1: Download Python
Go to python.org/downloads and download the latest version of Python 3.
- Windows: Download the
.exeinstaller. During installation, check the box that says “Add Python to PATH” — this is important. - macOS: Download the
.pkginstaller and follow the steps. - Linux: Python is usually pre-installed. Run
python3 --versionto check.
Step 2: Verify the Installation
Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux) and type:
python --version
Expected output:
Python 3.12.3
If you see a version number starting with 3, you are ready to go.
Step 3: Run Your First Program
In your terminal, type:
python
This opens the Python interactive shell (also called the REPL). You will see something like:
Python 3.12.3 (main, ...)
>>>
Now type this and press Enter:
print("Hello, world!")
Expected output:
Hello, world!
You just ran your first Python program. The print() function displays text on the screen.
To exit the shell, type exit() and press Enter.
Step 4: Install a Code Editor
Writing code in the terminal is fine for quick tests, but for real programs you need a code editor. The most popular free option is VS Code.
- Download it from code.visualstudio.com
- Install the Python extension (search for it in the Extensions panel)
- Create a new file called
hello.py - Type
print("Hello, world!")and save - Click the Run button (▶) or press
F5
What You Learned
- How to install Python on your operating system
- How to verify the installation with
python --version - How to use the Python shell
- How to run a Python script from a code editor
In the next lesson, you will learn about variables — how Python stores and remembers information.