Python Course #1: Installing Python and Your First Program
Welcome to the Python Course - Part 1 of 10

Welcome to the Python Course from Scratch! This is article 1 of 10 in a series designed to teach you how to program in Python with no prior experience required. If you have never written a single line of code, you are in the right place.
In this first article, we will install Python on your computer, write your first program, and get familiar with the tools you will use throughout the course. By the end of this article, you will have everything ready to start coding.
What is Python and why should you learn it?
Python is a programming language — a way to give instructions to your computer so it does what you want. Think of it as learning a new language, but instead of communicating with people, you communicate with your computer.
Python is one of the most popular languages in the world for several reasons:
- Easy to read: Python code looks a lot like English, making it ideal for beginners
- Versatile: You can use it to build websites, analyze data, create artificial intelligence, automate tasks, and much more
- Huge community: Millions of people use Python, so you will always find help online
- Free: Python is open source — you do not have to pay anything to use it
- Great job market: Python is one of the most in-demand languages in the tech industry
To give you an idea of how simple Python is compared to other languages, here is a program that displays a message on screen:
1# Python - simple and clean
2print("Hello, World")
That is it. One single line. In other languages, you would need to write much more code to achieve the same thing.
Installation on Windows
Follow these steps to install Python on Windows:
Step 1: Download Python
- Open your browser and go to the official website: python.org/downloads
- Click the big yellow button that says "Download Python 3.x.x" (the latest version)
- An
.exefile will be downloaded to your Downloads folder
Step 2: Run the installer
- Open the
.exefile you just downloaded - VERY IMPORTANT: Before clicking "Install Now", check the box that says "Add python.exe to PATH". This checkbox is at the bottom of the installer window
- Click "Install Now"
- Wait for the installation to finish (it may take 1-2 minutes)
- When you see the message "Setup was successful", click "Close"
Installation on macOS
macOS comes with an older version of Python preinstalled, but we need to install the latest version.
Option 1: From the official website
- Go to python.org/downloads
- Download the macOS installer (
.pkgfile) - Open the downloaded file and follow the installation wizard
- Click "Continue" on each step and then "Install"
Option 2: Using Homebrew (recommended for advanced users)
If you have Homebrew installed, simply open Terminal and type:
1brew install python3
Installation on Linux
Most Linux distributions come with Python preinstalled. But if you need to install it or update it, use your distribution's package manager.
Ubuntu / Debian
1# Update the package list
2sudo apt update
3
4# Install Python 3
5sudo apt install python3 python3-pip
Fedora
1sudo dnf install python3 python3-pip
Arch Linux
1sudo pacman -S python python-pip
Verify the installation
Now let's check that Python was installed correctly. To do this, we need to open a terminal (also called "command line"):
- Windows: Press the
Windowskey, typecmd, and press Enter - macOS: Open the "Terminal" application (it is in Applications > Utilities)
- Linux: Open your favorite terminal (usually with
Ctrl + Alt + T)
Type the following command and press Enter:
1python --version
You should see something like:
1Python 3.12.4
The exact number may vary, but the important thing is that it starts with 3. If you see an error or it says "Python 2.x", try:
1python3 --version
python3 instead of python. If python does not work, use python3 instead.
Your first program: Hello World
It is a tradition in programming that the first program you write displays the message "Hello World" on screen. Let's do it!
Step 1: Create a folder for your files
Create a folder on your computer called python-course. You can create it on your desktop or wherever you prefer. We will store all the course files here.
Step 2: Create the file
Open any text editor (for now, Notepad on Windows or TextEdit on macOS works fine) and type the following:
1print("Hello, World!")
Save the file inside your python-course folder with the name hello.py. The .py extension tells the computer that it is a Python file.
Step 3: Run the program
Open the terminal, navigate to your folder, and run the file:
1# Navigate to the folder (adjust the path based on where you created it)
2cd Desktop/python-course
3
4# Run the program
5python hello.py
You should see in the terminal:
1Hello, World!
Congratulations! You just wrote and ran your first Python program. The print() function displays on screen whatever you put between the parentheses and quotes.
Try changing the message:
1print("My name is Alex and I am learning Python")
2print("2 + 2 =", 2 + 2)
3print("Python is awesome!")
Run it again and you will see three lines in the terminal. Each print() outputs a new line.
The interactive interpreter (REPL)
Python has a very useful tool called the REPL (Read-Eval-Print Loop). It is a kind of "conversation mode" where you type code and Python responds immediately, line by line.
To open the REPL, type in your terminal:
1python
You will see something like this:
1Python 3.12.4 (main, Jun 8 2024, 18:29:57)
2Type "help", "copyright", "credits" or "license" for more information.
3>>>
The three symbols >>> indicate that Python is waiting for your instruction. Try typing:
1>>> print("Hello from the REPL")
2Hello from the REPL
3
4>>> 5 + 3
58
6
7>>> "Python" * 3
8'PythonPythonPython'
9
10>>> 100 / 7
1114.285714285714286
The REPL is perfect for experimenting. When you want to try something quickly, you do not need to create a file — just open the REPL, type your code, and see the result instantly.
To exit the REPL, type:
1>>> exit()
Install a code editor: Visual Studio Code
While you can write code in Notepad, it is much better to use a code editor. A code editor is like Notepad but with superpowers: it highlights your code with colors, warns you about errors, and helps you type faster.
The editor we recommend is Visual Studio Code (VS Code). It is free, lightweight, and very popular.
Step 1: Download VS Code
- Go to code.visualstudio.com
- Download the version for your operating system
- Install it following the installer instructions
Step 2: Install the Python extension
- Open VS Code
- Click the extensions icon in the left sidebar (it looks like a square with puzzle pieces)
- In the search bar, type "Python"
- Install the extension called "Python" by Microsoft (it is the first result, with millions of downloads)
Step 3: Open your project folder
- In VS Code, go to File > Open Folder
- Select your
python-coursefolder - Now you can see and edit all your files from VS Code
To create a new file, right-click in the file explorer on the left and select "New File". Name the file with a .py extension and start writing code.
Step 4: Run code from VS Code
With the Python extension installed, you can run your code directly from VS Code:
- Open a
.pyfile - Click the "play" button (triangle icon) that appears in the top-right corner
- A terminal will open inside VS Code showing the result
Summary and next article
In this first article of the course, we accomplished the following:
- Understood what Python is and why it is an excellent language to start programming
- Installed Python on Windows, macOS, or Linux
- Verified the installation using the terminal
- Wrote and ran our first program: Hello World
- Learned about the REPL for experimenting with code interactively
- Installed and configured VS Code as our code editor
You now have everything you need to start programming. In the next article (Part 2 of 10), we will learn about variables and data types — the fundamental building blocks of any program. You will learn how to store information, work with numbers and text, and build your first calculator.
See you in the next article!
Comments
Sign in to leave a comment
No comments yet. Be the first!