Home Blog Resume Contact

How to Install Python and Write Your First Program (Mac, Windows, Linux)

Sidali Assoul Sidali Assoul 1 min read

Last updated on

Installation

First of all you have to install python on your machine.

Depending on your operating system the steps may differ. But in MacOs and linux it’s just a matter of running a single command.

brew install python # MacOs

sudo apt install python3-full # Linux

On windows, just head to the python.org website, dowonload the corresponding binary, and make sure to check the “Add to PATH” option.

To confirm that it’s indeed installed, restart your terminal app, and then run:

python3 --version # or python --version

If a version number appears, then Python is succesfully installed on your system.

First Program: Hello World!

Let’s create our first Python program.

First, we need to create a “hello.py” file, open it with your preferred IDE, and then write a simple “print” statement that just prints “Hello, World!” to the console (the default standard output or “stdout”).

print("Hello, World!")

Output:

Now, let’s run out the previously created program by typing:

python3 hello.py # Or python

And then pressing on enter.

As expected a hello world gets printed on your console.

Output:

Hello, World!

You can also use Python’s interactive mode where any code you type executes line by line, by running the previous python3 command without any arguments.

python3  

Hello World Interactive Mode Python

Enjoyed this article?

I'm currently open to new roles — remote-first or international. If something resonated or you'd like to collaborate, I'd love to hear from you.

Connect on LinkedIn
Sidali Assoul

Written by

Sidali Assoul

Software engineer with 5 years in full stack web and mobile development, a proven track record in data science, research, and modern AI solutions, with a business-first engineering mindset for shipping products that deliver real value.

This article was originally published on https://sidaliassoul.com/blog/how-to-install-python-and-run-your-first-program-mac-linux-windows/. It was written by a human and polished using grammar tools for clarity.