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.
| Track | Python & Data Science |
| Lessons | 14 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | None beyond being able to open a text editor |
Lessons
- Python: getting startedRunning Python, indentation as syntax, variables, and the built-in types you touch in every script.
- StringsSlicing, f-strings, the methods you actually use, and why joins beat concatenation in loops.
- Lists, dicts and comprehensionsSlicing, mutability gotchas, comprehension syntax, and choosing the right collection for the job.
- Functions and modulesArguments, returns, scoping, lambdas, and organizing code into importable modules.
- Errors, files and virtualenvsReading tracebacks, using context managers safely, handling JSON, and keeping dependencies isolated.
- 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().
- Iterators, generators and itertoolsThe iterator protocol, yield, lazy pipelines, generator expressions, itertools recipes and yield from.
- Decorators, closures and context managersClosures and late binding, decorators written by hand with functools.wraps, decorator factories, and custom with-blocks via contextlib.
- Type hints and static checkingAnnotating functions and data, unions and generics, Protocol for structural typing, and how to run mypy and read its errors.
- Regular expressions and text processingre syntax, groups, greedy versus lazy quantifiers, findall against finditer, compiled patterns, substitution, and parsing logs.
- Testing with pytestTest discovery, plain asserts, fixtures, parametrisation, pytest.raises, monkeypatching and coverage.
- Concurrency: threads, processes and asyncioWhat the GIL really blocks, ThreadPoolExecutor for IO, ProcessPoolExecutor for CPU, async and await, asyncio.gather, and timeouts.
- Packaging, project layout and pyproject.tomlThe src layout, pyproject.toml and build backends, editable installs, publishing to PyPI, version pinning and lockfiles.
- 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.