Lesson 2 +10 XP

Getting Started with Python

Getting Started with Python

Before you can run Python, you need Python on your computer. Here is how.

Check if Python is installed

Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux) and type:

python --version

If you see something like Python 3.13.1, you're ready. If not, you need to install it.

Install Python

  • Go to python.org/downloads and download the latest version.
  • Run the installer. On Windows, tick the box that says "Add Python to PATH".
  • Follow the rest of the installer steps.

The Python command

On most systems you run your scripts with:

python myfile.py

Some systems use python3 instead. If python doesn't work, try python3.

The interactive shell (REPL)

Type python with no file name and you get the interactive shell. You can type code and see results instantly:

>>> print("Hello!")
Hello!

Type exit() or press Ctrl+Z (Windows) or Ctrl+D (macOS/Linux) to leave.

Write your first file

Create a file named hello.py with any text editor:

print("Hello, World!")

Then run it:

python hello.py

You should see:

Hello, World!

TL;DR

  • Check with python --version.
  • Download and install from python.org.
  • python myfile.py runs a script.
  • Type python alone to open the interactive shell.