>
> - 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"`
>
> def withdraw(self, amount):
> self.amount=amount
> if(amount > self.balance):
> return ("Amount greater than available balance.")
> else:
> self.balance -= amount
> return self.balance
>
The instructions say to "return 'invalid transaction'" but I expect they
really want that error printed to STDERR (typically your screen) rather
than literally returned. Try this:
def withdraw(self, amount):
self.amount=amount
if(amount > self.balance):
print "Amount greater than available balance, no funds withdrawn."
else:
self.balance -= amount
return self.balance
--
https://mail.python.org/mailman/listinfo/python-list