Python OOPS concepts LAB question. Need explanation

HI All, PFB question are part of python OOPS lab.

Help complete the complete the program

Open the file, and complete the code so that the Book class has
two new methods add_author and add_chapter.
Also, add a new subclass BookMeta, which has a price property and a rating method.
The price is related to the rating.

Follow the comments in the code for the exact actions these methods should perform.


Book info: Two Scoops of Django, 5 stars, 12.0

Book properties: {‘title’: ‘Two Scoops of Django’, ‘author’: ‘Greenfeld’, ‘chapter_number’: ‘3’, ‘chapter_title’: ‘Async Views’}

BookInfo properties: {‘title’: ‘Two Scoops of Django’, ‘author’: None, ‘info’: True, ‘price’: 12.0, ‘stars’: 5}

class Book:
def init(self, title):
self.title = title = None

def add_author(self, name):
    # add author property = name

def add_chapter(self, number, title):
    # add properties chapter_number and chapter_title
    self.chapter_number = number
    self.title = title

class BookInfo(Book):
def init(self, title, price, info=False):
Book.init(self, title)
# add properties price and info
self.price = price = info
self.stars = 0

def rating(self, stars):
        # check if existing stars are less than new stars
        # and if new stars are greater than 4
        # adjust new price by a 20% increase
        if (self.stars)
        # update the stars property
    except Exception as e:
        print(e, "Please try again")

Create a book object titled ‘Two Scoops of Django’

Add the author ‘Greenfeld’

Add a chapter 3, with title ‘Async Views’

Create a book_info object titled ‘Two Scoops of Django’

with a price of 10, and info set to True

Give the book_info a rating of 5 stars

print("Book info: “, end=” ")

Print book_info’s title, stars and price

…, str(book_info.stars) + " stars",
…, sep=", "

Print all properties of book and book_info objects

print("Book properties: ", …)
print("BookInfo properties: ", …)

What exactly is your question? Also please provide a link to the lab this comes from.

What you have pasted above is unintelligible as the formatting is all over the place. Formatting and indentation are part of the syntax in Python, so it is crucial that all code is

pasted in code block

or it cannot be checked.