Question: Python: please solve in python Part A: [20 pts] Write a class named Book that represents each book in a library. Each book has the
Python: please solve in python
Part A: [20 pts] Write a class named Book that represents each book in a library. Each book has the following attributes:
title: the title of the book.
author: the author of the book.
content: a string representing the text of the book.
- The Book class should have an initializer that accepts the books title, author, and content as arguments.
- These values should be assigned to the objects respective attributes.
The class should also have the following methods:
- read(): takes in a page number, and prints out the content of each page starting from the beginning until the given page number is reached.( Each page is separated by the character. ) - __str__() : return a string describing this book in terms of its name and author (e.g., " Wuthering Heights by Emily Bronte").
Part B: [15 pts]
Write a class named ComicBook that inherits the Book class from Part A. A ComicBook should have an additional boolean attribute is_superhero that indicates whether it is a comic about superheroes or not. The value of this attribute should be able to be set when initialized.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
