Need help on a project To :"Create a class called BankAccount with the following parameters "

Chris Angelico rosuav at gmail.com
Thu Dec 24 08:10:17 EST 2015


On Thu, Dec 24, 2015 at 11:59 PM,  <princeudo52 at gmail.com> wrote:
> here is what i came up with
> Class BankAccount(object):
> def_init_(self, balance):
> self.Balance = balance
> def deposit(self, amount):
> self.Balance = amount
> def withdraw(self,amount):
> if(self.Balance += amount):
> return invalid transaction
> #but my challange now is :Create a subclass MinimumBalanceAccount of the BankAccount class.

Step 1: Debug your code before you post it.

Step 2: Make sure that the way your code ends up is the same as the
way it started out. I suspect you have some of the above lines
indented, but that's getting lost.

Your code (a) will not compile, due to a complete lack of indentation;
(b) will not compile even if indented correctly, due to a misuse of an
'operator' that isn't actually an operator; (c) won't compile due to
invalid abuttal of tokens (did you intend to put quotes around
something?); (d) STILL won't compile because you misspelled a keyword;
and (e) won't do what you think it should, even once you make it
compile, because of logic errors. Don't move on to the second
challenge until you have mastered this first one.

ChrisA



More information about the Python-list mailing list