My code is giving the error as TypeError: __init__() takes 2 positional arguments but 4 were given
. tried searching for an extra argument but couldn't get one.
Tried previously answered questions but didn't get any proper solution.
My code is as follows:
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, price):
self.price = price
def display():
print('Title: {}'.format(title))
print('Author: {}'.format(author))
print('Price: {}'.format(price))
title=input()
author=input()
price=int(input())
new_novel=MyBook(title,author,price)
new_novel.display()
compiler gives runtime error as follows
Traceback (most recent call last):
File "Solution.py", line 23, in <module>
new_novel=MyBook(title,author,price)
TypeError: __init__() takes 2 positional arguments but 4 were given