Beginner Fundamentals

Install & first program

Check if it’s already installed

Many systems ship with Python. In the terminal:

python3 --version

If you see something like Python 3.12.0, it’s installed.

Install

  • Windows — download from python.org and check “Add Python to PATH”.
  • macOSbrew install python (Homebrew) or the official site.
  • Linux — usually preinstalled; otherwise sudo apt install python3.

Run code

Create a file app.py:

print("My first program")

Run it:

python3 app.py

Interactive mode (REPL)

Type python3 with no arguments and test commands live:

>>> 2 + 2
4
>>> print("hi")
hi

To exit: exit() or Ctrl+D.