Installing Python and Getting Started

Greetings! Some links on this site are affiliate links. That means that, if you choose to make a purchase, The Click Reader may earn a small commission at no extra cost to you. We greatly appreciate your support!

Your first Python programming lesson is here!

In this chapter, you will be installing Python on your operating system. This may not sound like fun, but the fruit of this lesson will be sweet, that is, you will be able to write your first line of Python code. ????

Before we start, you should know that Python uses an interpreter which is a computer program that directly executes written instructions. This means that all code written in Python is executed in a line by line manner using the Python interpreter.


How to install Python on Windows?

It is quite rare that a Windows operating system comes pre-installed with Python. However, installing it by yourself is pretty simple and quick.

All you have to do is download an executable installation file from Python’s official website and run it on your system. However, do make sure that you download the latest stable build of Python.

Here’s a step-by-step instruction on how to install Python for Windows:

Step 1: Download the latest stable build of Python from the following link: https://www.python.org/downloads.

Screenshot of Python Website

Step 2: Once the installer has been downloaded, run it. Make sure to select ‘Add Python 3.8 to PATH’ and press on ‘Install now’. If your downloaded Python version is different from Python 3.8 then the version name on the option will be different.

Screenshot of Python Installer

The installation time can take anywhere from 30 seconds to 2 minutes. Once the installation finishes, you are ready to use Python!


Installing Python on other operating systems

If you’re not using Windows, installing Python for your operating system includes downloading the appropriate installer and running it on your machine. Some operating systems provide a package manager that can be run to install Python.

If you are currently on macOS or on Unix, follow the steps in Python documentation to install Python:

Also, if you are using a mobile phone (Android and iOS), you can install apps that provide a Python programming environment.


Getting Started with Python – Hello, World!

It is time to write your first line of Python code!

Open your command prompt/terminal and type python. If you see a similar kind of message in your command prompt/terminal, then, you have successfully installed Python.

Python command executed in command prompt

Note: Your Python version may be different from the one shown in the image, depending on the version that you installed from the Python website.

Let us try writing a simple Hello World program to see Python in action.

print("Hello, World!")
Hello, World!
A simple hello world program in Python command prompt

You have successfully written your first line of Python code! Wasn’t it easy?


How to write comments in Python?

One last thing for this lesson — let us tell you how to write comments in Python since a good programmer always writes one.

Comments are programmer-readable notes or annotations in the source code of a computer program and are ignored by compilers and interpreters. There are two ways you can write comments in Python:

1. Single Line Comment – Single line comments in Python begin with a hash symbol (#).

# The line below prints “Hello, World!” to the console 
print("Hello, World!") 

2. Multiline comment/Block Comments – A multiline comment is wrapped with a set of triple quotes (“””).

"""
The line below prints “Hello, World!”
to the console
"""
print("Hello, World!") 

There you have it! You have installed Python, written your first line of Python code, and learned about the use of comments.

Leave a Comment