Complete the Library Hierarchy

Book and EBook are provided complete and working, each with its own describe(). Library is incomplete - add its three missing methods:

  • add_book(self, book) - appends book to self.books.
  • find_available(self) - returns a list of every book in self.books that is available, treating any item without an is_available attribute at all as available by default (use getattr(book, "is_available", True)).
  • describe_all(self) - returns a list of describe() strings, one per book, in order.

Read a library name, then a book's details, then an ebook's details, build the library, add both, borrow the first book directly, then print every line from describe_all() followed by the length of find_available() - proving your Library correctly handles two genuinely different classes polymorphically.

main.py
Loading editor…

Console

Run your code to see output here.