300+ Python exercises with solutions, organized by topic — written while learning Python, from the basics to more advanced data structures and algorithms.
Each folder contains exercises and their corrected solutions (corrigés), so you can attempt a problem first and then check your approach against a working answer.
🐍 Learning Python or brushing up before an interview? You're in the right place — browse a topic below, and if this saves you time, a ⭐ on this repo helps others find it too.
- Learning Python on your own — practice topic by topic, with a solution to check yourself against instead of guessing if your code is "right."
- Preparing for technical interviews — folders like
recursion,sort_search,linkedList, andheap_qcover classic interview topics. - Teaching or tutoring — a ready-made bank of exercises you can reuse or adapt for a class, workshop, or coding club.
- Quick reference — need a concrete example on
JSONparsing,re(regex), orfile_input_output? Find a working snippet instead of searching from scratch.
| Folder | Topic |
|---|---|
python_basic_I |
Python fundamentals |
conditional_statements_loops |
If/else statements, for/while loops |
functions |
Function definitions, arguments, return values |
lambda |
Lambda (anonymous) functions |
arrays |
Arrays / lists basics |
exos_list |
List exercises |
exos_dictionnary |
Dictionary exercises |
Sets |
Set operations |
Tuple |
Tuple exercises |
Collections |
The collections module (Counter, defaultdict, etc.) |
strings |
String manipulation |
class |
Object-Oriented Programming (classes, objects) |
Enum |
Enumerations |
recursion |
Recursive algorithms |
sort_search |
Sorting and searching algorithms |
linkedList |
Linked list implementations |
heap_q |
Heaps / priority queues (heapq) |
Bisect |
Binary search with the bisect module |
map |
The map() function and functional-style operations |
math |
The math module |
re |
Regular expressions |
JSON |
Reading/writing JSON data |
file_input_output |
File reading and writing |
Modules |
Working with Python modules |
python_programming |
General programming exercises |
- Pick a folder matching what you want to practice.
- Try to solve the exercise yourself first.
- Compare your solution with the corrected version (corrigé) in the same folder.
- Move to the next topic once you're comfortable.
- Python
If this repo helped you learn or review something, consider leaving a ⭐ — it's a small click that goes a long way for an open-source project.
Dona 😎