Question
[PYTHON]: Write the class Book that stores the title, author and number of pages of a book. Write the class method inventory() that returns the
[PYTHON]: Write the class Book that stores the title, author and number of pages of a book. Write the class method inventory() that returns the number of instances created. Write the special (or magic) methods, str, del and len that will return information to the user in the format shown below.
>>>book1 = Book("Beneath a Scarlet Sky", "Mark Sullivan", 526)
>>>book2 = Book("Love in the Time of Cholera", "Gabriel G. Marquez", 357)
>>>book3 = Book("We Were the Lucky Ones", "Georgia Hunter", 414)
>>>Book.inventory()
3
>>>print(book1)
TITLE: Beneath a Scarlet Sky by Mark Sullivan
>>>len(book1)
526
>>>del book1
>>>Book.inventory()
2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started