[Tutor] PLEASE I NEED HELP URGENTLY

David Rock david at graniteweb.com
Sat Jan 9 19:41:08 EST 2016


* precious akams via Tutor <tutor at python.org> [2016-01-09 19:54]:
> PLEASE I NEED A LITTLE HELP .
> I can figure out what Iam missing in this project
> 
> 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 IS MY SOLUTION
> 
> 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:
> return ('invalid transaction')
> 
> class MinimumBalanceAccount(BankAccount):
> def _init_(self):
> BankAccount_init_(self)
> 
> THIS IS THE ERROR MESSAGE I GOT
> 
> Internal Error: runTests aborted: TestOutcomeEvent(handled=False, test=, result=, outcome='error', exc_info=(, TypeError('this constructor takes no arguments',), ), reason=None, expected=False, shortLabel=None, longLabel=None) is not JSON serializable

This doesn't appear to be all of your code.  What's the code you are running that actually generates the traceback?

-- 
David Rock
david at graniteweb.com


More information about the Tutor mailing list