Question: Create a class called Book that stores the ISBN, title, author, and type for a book. Your class should have a creator that takes the

Create a class called "Book" that stores the ISBN, title, author, and type for a book. Your class should have a creator that takes the 4 values and assigns them to the attributes isbn, title, author, and type. Type may be: "F" for fiction, "N" for non-fiction, or "B" for Biography. Your class should also have a __str__ method that will return a string of the isbn, the title, the word by, the author, and type in parenthesis. Seperate all of these values with a space. In a main def (outside the class) create an instance of the class Book with an ISBN number of 1234567890123, a title of "The Great American Novel", the author "Wanna B. Author" and the type "F". Once you have created the object, print it out using a print function and the to string method. Call main at the bottom of your code to start the program.

The code has to include: Book has initializer as described, Book has to string method as described, create an instance of Book in main() and assign it to a variable, print called once in main, call main

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 Databases Questions!