Question: python: Create a class called Book. The class should have the following properties: a. Two attributes, author and title, both of which should be initialized
python:
Create a class called Book. The class should have the following properties:
a. Two attributes, author and title, both of which should be initialized to the blank string
b. An __init__ function that takes in an author and a title, and sets them to the object variables
c. A function called display, which when called, simply prints out a string representing the book. The output should be in the form of title, written by author. Example: Of Mice and Men, written by John Steinbeck.
3. Instantiate two objects from this class. The first object represents the book Of Mice and Men, written by John Steinbeck the other is To Kill a Mockingbird by Harper Lee.
4. Print both of these objects to the screen by calling their display() functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
