This project has been created as part of the 42 curriculum by wkratos.
A structured collection of Python exercises completed across eleven progressive modules, from basic syntax and control flow to object-oriented design, package management, data validation, functional programming, closures, and decorators.
PythonPool documents my progression through Python by combining focused exercises with small themed applications.
The repository covers:
- Python syntax and control structures
- Functions and recursion
- Object-oriented programming
- Inheritance and encapsulation
- Exception handling
- Command-line arguments
- Built-in collections
- Generators and data streams
- File and stream management
- Abstract classes and protocols
- Packages and import systems
- Virtual environments and dependencies
- Environment variables
- Pydantic data validation
- Functional programming
- Closures and decorators
PythonPool/
├── Module00/
├── Module01/
├── Module02/
├── Module03/
├── Module04/
├── Module05/
├── Module06/
├── Module07/
├── Module08/
├── Module09/
├── Module10/
├── .gitignore
└── README.md
Each module contains independent exercises that focus on a specific group of Python concepts.
| Module | Main Concepts |
|---|---|
Module00 |
Python basics, input/output, conditions, loops, functions, recursion and type hints |
Module01 |
Classes, objects, attributes, methods, encapsulation, inheritance, class methods and static methods |
Module02 |
Exceptions, custom exceptions, raising errors, cleanup with finally and error-safe program design |
Module03 |
Command-line arguments, lists, tuples, sets, dictionaries, generators and data analysis |
Module04 |
File handling, streams, context management, archive creation and safe resource cleanup |
Module05 |
Abstract base classes, polymorphism, protocols, reusable processors, pipelines and advanced type hints |
Module06 |
Python packages, modules, imports, relative imports, nested packages and circular-import management |
Module07 |
Advanced OOP, abstract interfaces, multiple inheritance, factories, strategies and tournament systems |
Module08 |
Virtual environments, package installation, dependency management and environment variables |
Module09 |
Structured data models, Pydantic validation, enums, field constraints and model-level validation |
Module10 |
Lambdas, higher-order functions, closures, scope, functools, decorators and function composition |
The modules gradually introduce:
- class creation;
- instance and class attributes;
- inheritance;
- encapsulation;
- abstract base classes;
- multiple inheritance;
- polymorphism;
- factory and strategy design patterns.
Module07 applies these concepts through a card-game system containing cards, decks, combat interfaces, factories, strategies, a game engine and a tournament platform.
Module02 explores reliable error management through:
tryandexcept;- multiple exception types;
- custom exception hierarchies;
- explicit
raisestatements; - cleanup using
finally; - validation before state changes.
The repository includes:
- generator-based streams;
- score and inventory analytics;
- numeric and text processors;
- abstract data streams;
- reusable processing pipelines;
- input, transformation and output stages.
Module06 builds a complete nested package structure:
alchemy/
├── elements.py
├── potions.py
├── grimoire/
│ ├── spellbook.py
│ └── validator.py
└── transmutation/
├── basic.py
└── advanced.py
It demonstrates:
- absolute imports;
- relative imports;
- package initialization;
- aliases;
- nested modules;
- circular dependency considerations.
Module10 focuses on:
- lambda expressions;
map,filterandsorted;- higher-order functions;
- closures and
nonlocal; functools.reduce;- function composition;
- reusable decorators;
- preserving metadata with
functools.wraps.
Most exercises only require:
Python 3.10+
Some later modules use additional packages:
pip install pandas numpy matplotlib requests python-dotenv pydanticUsing a virtual environment is recommended:
python3 -m venv .venv
source .venv/bin/activate
pip install pandas numpy matplotlib requests python-dotenv pydanticOn Windows:
python -m venv .venv
.venv\Scripts\activate
pip install pandas numpy matplotlib requests python-dotenv pydanticEach exercise can generally be executed independently.
Example:
python3 Module00/ex0/ft_hello_garden.pyRun an object-oriented exercise:
python3 Module01/ex6/ft_garden_analytics.pyRun the card game engine from Module07:
cd Module07
python3 -m ex3.mainRun a functional-programming exercise:
python3 Module10/ex4/decorator_mastery.pySome exercises accept command-line arguments:
python3 Module03/ex0/ft_command_quest.py hello python 42Module08 contains an environment-configuration exercise.
Create the local environment file from the example:
cp Module08/ex2/.env.example Module08/ex2/.envThen edit the values before running:
python3 Module08/ex2/oracle.pyThe real .env file is intentionally excluded from Git.
The main objectives of this repository were to:
- understand Python syntax and conventions;
- write readable and reusable functions;
- model systems with classes and inheritance;
- handle errors safely;
- work with Python collections effectively;
- process data through generators and pipelines;
- organize code into packages and modules;
- manage project environments and dependencies;
- validate structured data;
- understand functional programming techniques;
- build progressively larger Python applications.
- Every module represents a different stage of the learning process.
- Exercises are intentionally kept separate to preserve their original scope.
- The repository contains educational implementations rather than one single production application.
- Some programs use themed scenarios such as gardens, games, alchemy, space stations and magic to demonstrate technical concepts.
wkratos
42 Network.