class Account(object): """A bank account that allows deposits and withdrawals.""" interest = 0.02 def __init__(self, account_holder): self.balance = 0 self.holder = account_holder def deposit(self, amount): """Increase the account balance by amount and return the new balance.""" self.balance = self.balance + amount return self.balance def withdraw(self, amount): """Decrease the account balance by amount and return the new balance.""" if amount > self.balance: return 'Insufficient funds' self.balance = self.balance - amount return self.balance class CheckingAccount(Account): """A bank account that charges for withdrawals.""" withdraw_fee = 1 interest = 0.01 def withdraw(self, amount): return Account.withdraw(self, amount + self.withdraw_fee) class SavingsAccount(Account): """A bank account that charges for deposits.""" deposit_fee = 2 def deposit(self, amount): return Account.deposit(self, amount - self.deposit_fee) class AsSeenOnTVAccount(CheckingAccount, SavingsAccount): """A bank account that charges for everything.""" def __init__(self, account_holder): self.holder = account_holder self.balance = 1 # A free dollar! supers = [c.__name__ for c in AsSeenOnTVAccount.mro()]