need to create a minimum balance account which inherited from the parent bank account class.

also need to override the withdraw method to check if minimum balance is maintained

class  bankaccount:
def __init__(self,name,accountno, bal=0):
    self.name= name
    self.accountno=accountno
    self.bal=bal
def deposit(self,amount):
    self.bal+=amount        
    print ('dear',self.name, 'having account no',self.accountno,'you have deposited',amount,  '\n remaining balance',self.bal )
def withdraw(self,amount):        
    if self.bal>=amount:
        self.bal-=amount
        print('your withdrawl of rs',amount, "is succesful")
    else:
        print('insufficiant balance')
def checkbal(self):
    print ("\n Net Available Balance =", self.bal)

class minbalbankaccount(bankaccount):
def __init__(self, minimumbal):
    bankaccount.__init__(self)
    self.minimumbal= minimumbal
def withdraw(self, amount):
    if self.bal - amount < self.minimumbal:
        print ('Sorry, minimum balance must be maintained.')
    else:
        bankaccount.withdraw(self,amount)
        print('remaining bal',self.bal)

GETTING AN ERROR init() missing 2 required positional arguments: 'name' and 'accountno'

0 Answers