Python 3

The current Python: syntax, collections, functions and files.

Python 3 is taught here in 14 lessons, running from Python: getting started through to Command-line tools: argparse and logging. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.

TrackPython & Data Science
Lessons14
LevelBeginner to intermediate
Reading timeabout 3 hours
PrerequisitesNone beyond being able to open a text editor

Lessons

  1. Python: getting startedRunning Python, indentation as syntax, variables, and the built-in types you touch in every script.
  2. StringsSlicing, f-strings, the methods you actually use, and why joins beat concatenation in loops.
  3. Lists, dicts and comprehensionsSlicing, mutability gotchas, comprehension syntax, and choosing the right collection for the job.
  4. Functions and modulesArguments, returns, scoping, lambdas, and organizing code into importable modules.
  5. Errors, files and virtualenvsReading tracebacks, using context managers safely, handling JSON, and keeping dependencies isolated.
  6. Object-oriented Python: classes and dunder methodsClasses that behave like built-in types: instance versus class state, __repr__ and __eq__, properties, dataclasses, and inheritance with super().
  7. Iterators, generators and itertoolsThe iterator protocol, yield, lazy pipelines, generator expressions, itertools recipes and yield from.
  8. Decorators, closures and context managersClosures and late binding, decorators written by hand with functools.wraps, decorator factories, and custom with-blocks via contextlib.
  9. Type hints and static checkingAnnotating functions and data, unions and generics, Protocol for structural typing, and how to run mypy and read its errors.
  10. Regular expressions and text processingre syntax, groups, greedy versus lazy quantifiers, findall against finditer, compiled patterns, substitution, and parsing logs.
  11. Testing with pytestTest discovery, plain asserts, fixtures, parametrisation, pytest.raises, monkeypatching and coverage.
  12. Concurrency: threads, processes and asyncioWhat the GIL really blocks, ThreadPoolExecutor for IO, ProcessPoolExecutor for CPU, async and await, asyncio.gather, and timeouts.
  13. Packaging, project layout and pyproject.tomlThe src layout, pyproject.toml and build backends, editable installs, publishing to PyPI, version pinning and lockfiles.
  14. Command-line tools: argparse and loggingargparse subcommands and flags, meaningful exit codes, the logging module's levels and handlers, and configuration from environment variables and files.

More in Python & Data Science

NumPy pandas Matplotlib Jupyter Notebook Flask FastAPI Django SciPy Pillow Python 2.x R Julia

FAQ

How long does the Python 3 course take?
It has 14 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for Python 3?
No. This is the first course in Python & Data Science, so it starts from the beginning and assumes no background.
What should I read after Python 3?
Continue with NumPy (12 lessons), the next course in Python & Data Science.

Last refreshed 2026-09-18.