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.
year_published: The year the book was published.
The class should also have the following methods: __init__(self, title, author, genre, year_published): This constructor method initializes the attributes of the book object.
display_book_info(): This method prints the title, author, genre, and year_published of the book object.
Create an instance of the Book class and call the display_book_info() 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 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 Programming Questions!