Question: Create a Python class called Book with the following attributes: title: The title of the book. author: The author of the book. genre: The genre
Create a Python class called Book with the following attributes:
title: The title of the book.
author: The author of the book.
genre: The genre of the book.
yearpublished: The year the book was published.
The class should also have the following methods: initself title, author, genre, yearpublished: This constructor method initializes the attributes of the book object.
displaybookinfo: This method prints the title, author, genre, and yearpublished of the book object.
Create an instance of the Book class and call the displaybookinfo method to display the information about the book.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
