Need help with this asap.

ifeanyioprah at yahoo.com ifeanyioprah at yahoo.com
Tue Jan 12 00:48:04 EST 2016


Create a class called BankAccount
Create a constructor that takes in an integer and assigns this to a `balance` property.
Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly.
Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"`
Create a subclass MinimumBalanceAccount of the BankAccount class.
This was my solution and I still got error. What should I do.
class BankAccount: 
    def __init__(self, initial_amount): 
        self.balance = initial_amount 
    def deposit(self, amount): 
        self.balance += amount 
    def withdraw(self, amount): 
        if self.balance>= amount: 
            self.balance  -=  amount 
        else: 
          print('invalid transaction') 
a1 = BankAccount (90) 
a1.deposit(90) 
a1.withdraw(40) 
a1.withdraw(1000) 
class MinimumBalanceAccount(BankAccount): 
    def __init__(self): 
        BankAccount.__init__(self) 

Please help me.


More information about the Python-list mailing list