mirror of
https://github.com/blshaer/python-by-example.git
synced 2026-03-27 23:29:25 +01:00
| .. | ||
| README.md | ||
| solution.py | ||
📚 Project 03: Library Management System
Difficulty: 🟠 Advanced
Description
Build an object-oriented Library Management System where users can manage books, members, and borrowing/returning of books. This project emphasizes classes, inheritance, encapsulation, and error handling.
Requirements
- Create a
Bookclass with title, author, ISBN, and availability status - Create a
Memberclass with name, member ID, and borrowed books list - Create a
Libraryclass that manages books and members - Allow adding/removing books from the library catalog
- Allow registering new members
- Implement borrow and return functionality with proper validation
- Handle edge cases: book already borrowed, member limit reached, book not found
- Display library catalog and member details
Concepts You'll Practice
- Classes and Objects
- Inheritance and Encapsulation
- Properties and Methods
- Custom Exceptions
__str__and__repr__magic methods- Composition (Library has Books and Members)
Example Output
📚 LIBRARY MANAGEMENT SYSTEM
=============================
1. View Catalog
2. Add Book
3. Register Member
4. Borrow Book
5. Return Book
6. View Member Info
7. Exit
Choose: 4
Enter Member ID: M001
Enter Book ISBN: 978-0-13-110362-7
✅ "The C Programming Language" has been borrowed by Alice.
Due date: 2025-02-15
Books borrowed: 1/3
How to Run
cd projects/03_library_management
python solution.py
Bonus Challenges
- Add due dates and overdue book tracking
- Save library data to JSON for persistence
- Add search functionality (by title, author, or ISBN)