Python Get Started
Install Python, run your first file.
Getting started with Python means installing the interpreter, choosing an editor, and learning how to execute a .py file. Python ships pre-installed on macOS and most Linux distros; on Windows you grab it from python.org. Once installed, two commands cover 95 % of your workflow: python --version to verify it's working, and python yourfile.py to run a script.
Windows: Download the installer from https://python.org/downloads — check Add Python to PATH before clicking Install Now.
macOS: brew install python (recommended) or use the python.org installer.
Linux: It's almost certainly already installed. Run python3 --version to check.
Verify your install in a fresh terminal:
bashpython --version # or: python3 --version
- Install Visual Studio Code: https://code.visualstudio.com
- Install the official Python extension from Microsoft (Ctrl+Shift+X → search Python).
- Open any folder, create a new file
hello.py, and VS Code will offer to pick the interpreter. Optional but recommended: also install Pylance for smart auto-complete and Python Indent for clean blocks.
Create a file called hello.py and paste:
python# hello.py — your first Python program print("It works!") print("Today's lesson:", "Get Started")
Method 1 — Terminal (works everywhere)
bashpython hello.py
Method 2 — VS Code Run button (top-right ▶ triangle once Python extension is installed).
Method 3 — Codekilla compiler at /compiler — paste, click Run.
It works!
Today's lesson: Get Started
Run python with no arguments to drop into the interactive shell:
>>> 2 + 3
5
>>> name = "Asha"
>>> f"Hello, {name}"
'Hello, Asha'
>>> exit()
The REPL is amazing for prototyping. Ctrl+D (Linux/macOS) or exit() leaves the shell.
Always isolate project dependencies with a virtual environment:
bashpython -m venv .venv # create source .venv/bin/activate # macOS / Linux .venv\\Scripts\\activate # Windows pip install requests # installs only into this venv
- Verify your install with
python --version(orpython3 --version). - Run any script with
python yourfile.py. - VS Code + Python extension is the fastest beginner setup.
- The REPL (
pythonwith no args) is your live calculator. - Use
python -m venv .venvfor every new project — keeps dependencies tidy.
- Install Python and confirm
python --versionshows 3.10 or higher. - Create
intro.pythat prints your name and the current date (from datetime import date; print(date.today())). - Open the REPL and compute
(1024 ** 2)— confirm it's 1,048,576.
- Close and reopen any terminal that was running before you installed Python — PATH only refreshes on new shells.
- On Windows, save files with
.pyextension — Notepad sometimes secretly adds.txt. - Never edit Python files in Microsoft Word — it adds invisible characters that break the parser.
Quick recap quiz?
We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.
