In models/book.py
Define a class, Book, with its __init__(self, title, author, year, available) method, which sets title (str), author (str), year (int), and available (bool) attributes.
In models/book.py
Define Book's is_old(self) method that returns True if the book was published before 2000. Return False otherwise.
In models/library.py
Define a class, Library, that receives a list of Book objects and sets its books attribute.
In models/library.py
Define Library's available_books(self) method, that returns a list of books that are currently available.
In models/library.py
Add a method books_by_author(self, author) to Library that returns a list of books written by the given author.
In models/library.py
Add a method oldest_book(self) to Library that returns the Book object with the earliest publication year. Return None if the library has no books.
In models/library.py
Add a method most_prolific_author(self) to Library that returns the name of the author who has the most books in the library. Return None if the library has no books.
In report.py
Create a class LibraryReport that receives a Library instance and assigns it to library attribute.
In report.py
Create a LibraryReport method, print_report(self), that prints:
- Total number of books in the library
- Number of available books
- The oldest book (title and year)
- The most prolific author
Example:
Total books in library: 5
Available books: 3
Oldest book: 'Pride and Prejudice' (1813)
Most prolific author: Jane Austen