Sobes.tech
Junior — Middle+

Creating Book and Library classes based on specified usage

livecode

Task condition

Based on the provided example, implement two classes — Book and Library — so that the script runs correctly.

library = Library()

book1 = Book("1984", "George Orwell", 1949)
book2 = Book("To Kill a Mockingbird", "Harper Lee", 1960)
book3 = Book("Brave New World", "Aldous Huxley", 1932)

library.add_book(book1)
library.add_book(book2)
library.add_book(book3)

print("All books in the library:")
library.show_books()

print("\nBooks by 'George Orwell':")
orwell_books = library.find_by_author("George Orwell")
for book in orwell_books:
    print(book.info())

library.remove_book("1984")

print("\nAfter removing '1984':")
library.show_books()
Creating Book and Library classes based on specified… - sobes.tech