Python Tutorial

Getting Started with Python

Python is a beginner-friendly language used for everything from web apps to data science. This lesson gets you from zero to running your first script.

Check your installation

Open a terminal and check whether Python is already installed:

python3 --version

If you see a version number like Python 3.12.4, you’re ready to go. Otherwise, install it from python.org.

Your first script

Create a file named hello.py with the following contents:

print("Hello, World!")

Run it from your terminal:

python3 hello.py

You should see:

Hello, World!

The interactive shell

You can also run Python line-by-line without creating a file, using the REPL:

python3
>>> print("Hello from the REPL")
Hello from the REPL
>>> 2 + 2
4

Type exit() to leave the shell.

Next, learn how Python stores data in variables and types.