A structured, notebook-based Python reference: from syntax basics to object oriented programming, regular expressions and type hints. Every topic is a notebook with explanations and code examples.
Read it online: Python Complete Reference Notebook on Kaggle
- Offline notebooks in
notebooks/: 58 notebooks in 10 folders, one topic per notebook, meant for studying and quick lookup. - One unified notebook in
kaggle/: all 10 parts in a single file (246 cells, 109 of them code) with a clickable roadmap and a table of contents. It is designed to run top to bottom without manual input and is the source of the Kaggle notebook above.
Part N of the unified notebook is the folder N - ... in notebooks/, and section N.M is file M - ... inside that folder. For example, section 5.9 (Decorators) is 05 - Functions/09 - Decorators.
| Part | Topic | Notebooks | What it covers | Suggested background |
|---|---|---|---|---|
| 1 | Python Fundamentals | 7 | Comments, data types & strings, variables, type conversion, user input, operators, all 35 keywords | Start here |
| 2 | Python Collections | 5 | Lists, tuples, sets & frozen sets, dictionaries, booleans, container comparison guide | Part 1 |
| 3 | Built-ins & Modules | 3 | Built-in functions by category, built-in modules and import, external packages with pip |
Parts 1-2 |
| 4 | Control Flow | 5 | if / elif / else, while and for loops, iterables vs iterators, generators |
Parts 1-2 |
| 5 | Functions | 10 | Parameters, defaults, *args / **kwargs, scope, return, recursion, lambda, decorators, docstrings |
Parts 1, 4 |
| 6 | File Handling | 2 | Opening, reading and writing files, file modes, seek / tell and other file methods |
Parts 1, 5 |
| 7 | Errors & Exceptions | 2 | Common exception types, raise, try / except / else / finally |
Parts 1, 4, 5 |
| 8 | Regular Expressions | 5 | Regex syntax, character classes, quantifiers, groups, assertions, the re functions, flags and performance |
Part 1 (strings) |
| 9 | Object Oriented Programming | 13 | Classes, encapsulation, inheritance and MRO, polymorphism, ABCs, dunder methods, descriptors, dataclasses, design patterns | Parts 1-5, 7 |
| 10 | Type Hinting | 6 | Type hint basics, unions and aliases, generics, protocols, TypedDict, advanced typing, runtime introspection, 3.14 notes |
Parts 5, 9 |
Open 00 - Python Notebook Content for a quick offline index (written in Arabic), or use the list below.
01 - Python Fundamentals (7 notebooks)
02 - Python Collections (5 notebooks)
03 - Built-ins & Modules (3 notebooks)
04 - Control Flow (5 notebooks)
05 - Functions (10 notebooks)
06 - File Handling (2 notebooks)
07 - Errors & Exceptions (2 notebooks)
08 - Regular Expressions (5 notebooks)
09 - Object Oriented Programming (13 notebooks)
01 - OOP Foundations02 - Classes, Instances & __init__03 - Attributes & Methods04 - Encapsulation & Properties05 - Class & Static Methods06 - Inheritance & super07 - Multiple Inheritance, MRO & Mixins08 - Polymorphism, Duck Typing & Composition09 - Abstract Base Classes10 - Dunder Methods & Operator Overloading11 - Object Model, Descriptors & __slots__12 - Dataclasses & Enums13 - OOP Design, Advanced Patterns & Best Practices
10 - Type Hinting (6 notebooks)
01 - Type Hints Foundations02 - Collections, Union Types & Type Aliases03 - TypeVar, Generic, Literal, Final & ClassVar04 - Protocols, TypedDict, NamedTuple & Callable05 - Advanced Type Hints_ Self, TypeGuard, overload, ParamSpec & Annotated06 - Typing Tools, Runtime Introspection & Python 3.14 Notes
Only Python and JupyterLab are needed. The notebooks use the standard library only, so there is nothing else to install.
cd python-complete-reference
pip install jupyterlab
jupyter labNotes:
- Python version: use Python 3.13 or newer for the offline notebooks. Two Type Hinting notebooks demonstrate newer features (
typealiases need 3.12+,typing.TypeIsneeds 3.13+). The unified notebook inkaggle/includes version guards and is written to run on Python 3.11 or newer. - Run cell by cell in the offline notebooks. Some cells show errors or wait for keyboard input on purpose, so "Run All" can stop early there. The unified notebook is the version designed for "Run All".
- Language: everything is in English, except the
00index notebook and two short annotations in01 - Python Fundamentals/02 - Data Typesand02 - Python Collections/03 - Sets & Frozen Sets, which contain a few Arabic words.
python-complete-reference/
├── README.md
├── LICENSE
├── kaggle/
│ ├── Python-Complete-Reference.ipynb # unified notebook (source of the Kaggle notebook)
│ └── kernel-metadata.json # Kaggle API metadata
└── notebooks/
├── 00 - Python Notebook Content.ipynb
├── 01 - Python Fundamentals/
├── 02 - Python Collections/
├── 03 - Built-ins & Modules/
├── 04 - Control Flow/
├── 05 - Functions/
├── 06 - File Handling/
├── 07 - Errors & Exceptions/
├── 08 - Regular Expressions/
├── 09 - Object Oriented Programming/
└── 10 - Type Hinting/
After editing kaggle/Python-Complete-Reference.ipynb, push it with the Kaggle CLI:
kaggle kernels push -p kaggleKeep your Kaggle API credentials (kaggle.json) out of the repository. It is already listed in .gitignore.
Maintained by mahmoud15 on Kaggle. Issues and suggestions are welcome.