Book class and a Solution class, write a MyBook class that does the following:
title & authorpricedisplay() method so it prints 3 lines:
titleauthorprice1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
def __init__(self,title,author):
self.title=title
self.author=author
@abstractmethod
def display(): pass
#Write MyBook class
title=input()
author=input()
price=int(input())
new_novel=MyBook(title,author,price)
new_novel.display()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
def __init__(self,title,author):
self.title=title
self.author=author
@abstractmethod
def display(): pass
#Write MyBook class
class MyBook(Book):
def __init__(self,title,author,price):
super().__init__(title,author)
self.price = price
def display(self):
print("Title: {}".format(self.title))
print("Author: {}".format(self.author))
print("Price: {}".format(self.price))
title=input()
author=input()
price=int(input())
new_novel=MyBook(title,author,price)
new_novel.display()