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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!