🐍 Python Low Level Design Problems¶
A comprehensive collection of 24 Low-Level Design (LLD) problems implemented in Python, following SOLID principles and design patterns — curated for 6+ years experienced backend developer interviews.
🆕 Also check out our Java Low-Level Designs and Golang Low-Level Designs!
📋 Project Index¶
| # | Project | Focus Area | Key Design Patterns |
|---|---|---|---|
| 1 | Parking Lot | OOD Basics, Vehicle Management | Strategy, Factory, Singleton |
| 2 | Chess Game | Game State, Complex Rules | Factory, State, Memento |
| 3 | Tic-Tac-Toe | Simple Game, AI (Minimax) | Strategy, State, Command |
| 4 | Snakes & Ladders | Board Game, Dice Strategies | Strategy, Observer, State |
| 5 | Vending Machine | State Machine, Payments | State, Strategy, Factory |
| 6 | LRU/LFU/TTL Cache | Data Structures, Eviction | Strategy, Decorator |
| 7 | Rate Limiter | API Rate Limiting | Strategy, Factory, Decorator |
| 8 | Pub-Sub System | Messaging, Events | Observer, Strategy, Decorator |
| 9 | Movie Ticket Booking | Concurrency, Booking | Strategy, Singleton, Observer |
| 10 | Splitwise (Expense Sharing) | Graphs, Debt Simplification | Strategy, Factory |
| 11 | Cab Booking (Uber) | Real-time Matching, GeoRadius, Kafka, Zone Surge | Strategy, State, Observer, Pub-Sub |
| 12 | Library Management | Catalog, Fines, Circulation | Strategy, Observer, Facade |
| 13 | Car Rental Platform | Fleet, Availability Calendar, Hourly Booking | Strategy, State, Decorator |
| 14 | ATM/Banking System | State Machine, Security | State, Strategy, Chain of Responsibility |
| 15 | Inventory Management | Stock, Reorder, Warehouse | Strategy, Observer, Facade |
| 16 | Payment Processing | Payments, Refunds, Fraud | Strategy, Chain of Responsibility |
| 17 | Job Scheduling | Scheduling, Recurring Jobs | Command, Strategy, Observer |
| 18 | Search Platform | Indexing, Ranking, BM25 | Strategy, Facade |
| 19 | Notification Service | Multi-channel delivery, Retries, Quiet Hours | Strategy, Observer |
| 20 | Big File Upload | Resumable Chunked Uploads (TUS) | Strategy, Repository, State Machine |
| 21 | Order Matching Engine | Order Book, Price-Time Priority, Sequencer | Command, Event Sourcing |
| 22 | Circuit Breaker & Resilience | Retry, Backoff, Bulkhead, Timeout | State, Decorator |
| 23 | Food Delivery | Order State Machine, Dispatch, Idempotent Checkout | State, Strategy, Observer |
| 24 | Logging Framework | Logger Hierarchy, Async Handlers, Correlation IDs | Chain of Responsibility, Strategy |
🎯 New: start with the LLD Interview Playbook: time-boxed round script, Senior vs Staff signals, a concurrency toolkit for Python/Java/Go, and a 3-week practice plan.
Every project ships a test_<module>.py (stdlib unittest):
🎯 SOLID Principles Applied¶
Each project is designed following SOLID principles:
- S - Single Responsibility: Each class has one clear purpose
- O - Open/Closed: Open for extension, closed for modification
- L - Liskov Substitution: Subtypes are substitutable for base types
- I - Interface Segregation: Small, focused interfaces
- D - Dependency Inversion: Depend on abstractions, not concretions
🧩 Design Patterns Used¶
| Pattern | Usage |
|---|---|
| Strategy | Pricing, fee calculation, eviction strategies, matching algorithms |
| Factory | Vehicle, piece, player, document creation |
| Observer | Notifications, display updates, event handling |
| State | Vending machine, ATM, game states |
| Facade | Unified service interfaces |
| Decorator | Adding features without modifying core classes |
| Command | Job execution, undo/redo operations |
| Chain of Responsibility | Validation pipelines, fraud checks |
| Singleton | Cache manager, broker instance |
🚀 How to Run¶
Each project is self-contained. Navigate to the project directory and run:
Or run all projects from root:
for dir in python-low-level-design/*/; do
echo "=== Running $dir ==="
cd "$dir" && python *.py && cd - > /dev/null
done
📖 Interview Preparation¶
Each project includes an INTERVIEW_QUESTIONS.md file with:
- Core design questions with follow-ups
- Expected solution points
- Design pattern discussions
- Trade-off analyses
- Scalability considerations
🏆 Recommended Roadmap¶
- Start with basics: Parking Lot, Vending Machine, Tic-Tac-Toe
- Move to games: Chess, Snakes & Ladders
- Learn data structures: LRU Cache, Rate Limiter
- Build systems: Library Management, Inventory, Car Rental
- Master real-world: Splitwise, Movie Booking, Uber
- Advanced: Payment Processing, Job Scheduling, Search Platform