Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Pearson Newsgroups: comp.lang.python Subject: Re: i cant seem to figure out the error Date: 3 Apr 2016 18:18:10 GMT Lines: 39 Message-ID: References: X-Trace: individual.net OKATstQvinr8kHOxjlRsvAMZXD+MXzJbwiBjTry/m10cUuKBjc Cancel-Lock: sha1:y6ct4brlEgAjpzcRnPdrpbp5KA0= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:106385 On Sun, 3 Apr 2016 16:06:58 +0100, anthony uwaifo wrote: [snip] > > class BankAccount(object): > def __init__(self, balance): > self.balance = balance > > > def deposit(self, amount): > self.amount=amount > self.balance += amount > return self.balance > > > def withdraw(self, amount): > self.amount=amount > if(amount > self.balance): > return ("Amount greater than available balance.") > else: > self.balance -= amount > return self.balance > > > > class MinimumBalanceAccount(BankAccount): > def __init__(self, minimum_balance): > BankAccount.__init__(self) > self.minimum_balance = minimum_balance > > act = BankAccount(5) > act.deposit(400) > act.withdraw(200) > print act.balance There is an indentation error following the "else:" line. After I fixed that, the program runs and prints "205" (under Python 2.7.3). -- To email me, substitute nowhere->runbox, invalid->com.