Python Atlas
Foundations

Python Foundations

Set up Python 3.12+ and follow a practical path from values to reusable functions.

Python is easiest to learn by running small programs, predicting their results, and changing one thing at a time. This track builds the vocabulary and habits needed for scripts, data work, web applications, and later object-oriented programming.

Target version

These lessons use Python 3.12 or newer. Most examples also work on recent older versions, but install a supported release so error messages and language features match the course.

Learning path

Work through the pages in order:

  1. Syntax and values — names, types, expressions, and mutability.
  2. Operators and conditionals — compute values and make decisions.
  3. Strings and built-ins — process text and use Python's standard tools.
  4. Lists and tuples — model ordered collections.
  5. Dictionaries and sets — model lookup tables and unique membership.
  6. Iteration — loop directly, pair data, transform it, and sort it.
  7. Functions — package behavior behind clear interfaces.
  8. Arguments and unpacking — design flexible calls and destructure values.

Install and verify Python

Download Python from python.org or use your operating system's package manager. On Windows, enable the option that adds Python to PATH.

Open a terminal and verify the interpreter:

python --version
Python 3.12.4

Some systems expose Python 3 as python3 or the Windows launcher as py:

python3 --version
py -3.12 --version

Use whichever command reports the intended version consistently.

Run Python in two ways

The interactive shell is ideal for experiments:

python
>>> 2 + 3
5
>>> exit()

For programs you want to keep, create hello.py:

name = "Ada"
print(f"Hello, {name}!")

Then run it:

python hello.py

Python executes a file from top to bottom. When something fails, read the final line of the traceback first: it names the exception and usually explains the immediate problem.

A useful project setup

Create a virtual environment for each project. It isolates installed packages:

python -m venv .venv

Activate it on Windows PowerShell:

.\.venv\Scripts\Activate.ps1

Activate it on macOS or Linux:

source .venv/bin/activate

The standard library examples in this track need no third-party packages.

How to study

For every example:

  1. Predict the output before running it.
  2. Type it rather than pasting it.
  3. Change inputs and observe what remains true.
  4. Explain the result in plain language.
  5. Turn the idea into a tiny program.

Choose names that state intent (total_price, not tp), keep programs small, and prefer obvious code over clever shortcuts.

Common mistakes

  • Running the wrong interpreter: compare python --version inside and outside your virtual environment.
  • Naming a file after a standard module: files such as random.py or json.py can shadow the real modules.
  • Typing shell commands at >>>: leave the Python shell before running terminal commands.
  • Ignoring the whole traceback: the first cause may be several lines above the final error.
  • Learning only by reading: syntax becomes usable only through retrieval and practice.

Practice

  1. Verify that Python 3.12+ is available.
  2. Create and activate a virtual environment.
  3. Write a program that stores your name and current learning goal, then prints both.
  4. Intentionally misspell print, run the file, and identify the exception type and line.

LEARNING RECORD

Finish this lesson

Mark it complete when you can explain the main decision without looking.

KNOWLEDGE CHECK

Python Foundations

1What is the best first check before following the track's examples?
2Why does the lesson recommend a virtual environment for each project?