正在加载图片...
Implementing the Account Class Python Tutor link class Account: max_withdrawal 10 def __init__(self,account_holder): """Creates an instance of the Account class""" self.balance 0 self.holder account_holder def deposit(self,amount): """Deposits amount to the account.""" self.balance self.balance amount return self.balance def withdraw(self,amount): """Subtracts amount from the account.""" if amount self.max_withdrawal or amount self.balance: return "Can't withdraw this amount" self.balance self.balance amount return self.balanceImplementing the Account Class class Account: max_withdrawal = 10 def __init__(self, account_holder): """Creates an instance of the Account class""" self.balance = 0 self.holder = account_holder def deposit(self, amount): """Deposits amount to the account.""" self.balance = self.balance + amount return self.balance def withdraw(self, amount): """Subtracts amount from the account.""" if amount > self.max_withdrawal or amount > self.balance: return "Can’t withdraw this amount" self.balance = self.balance - amount return self.balance Python Tutor link
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有