from account import Account class PAccount(account.Account): def __init__(self,name,amount): pass Account.__init__(self, name) ##Account.deposit(self, amount) self.deposit(amount) # self.__class__.deposit(self, amount) b3 = PAccount('ann', 100) b1 = Account('joe') b1.deposit(1000) assert(b3 !=None) position = 0 all_acs = [b1, b3] for ac in all_acs: if not isinstance(ac,Account): raise TypeError('not bank account') position +=ac.get_balance() print position print 'Platinum tests passed'
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question