Programming

How do I start with Python? Install and first program

Installing Python, checking it in the terminal and the first print program.

All lessons · Python lessons: learn from scratch

Installing Python

Download Python from python.org. On Windows, tick “Add python.exe to PATH” in the first installer window, otherwise the terminal will not find Python.

Open a terminal and check the version:

python --version
# on macOS / Linux it is often:
python3 --version

If you see a number starting with 3, you are ready.

Your first program

Create a file named hello.py, put this in it and save:

name = input("Your name: ")
print("Hello,", name)

Then run it in the terminal, from the same folder:

python hello.py

Typical beginner problems

  • “python is not recognized”: PATH was not added — run the installer again.
  • Do not name your file after a built-in module (for example random.py).
  • Write code in an editor such as VS Code or IDLE, not in Word.

Author: Nibras Code