正在加载图片...
The Class Statement Global frame Account instance class Account: Account balance 0 max_withdrawal 10 holder “Tiff" def __init__(self,account_holder): self.balance =0 Instance self.holder account_holder attributes Account class def deposit(self,amount): max_withdrawal 10 func __init__(..\) Class attribute __init__ [p=G] def withdraw(self,amount): deposit func deposit(...) withdraw [p=G] >>a Account('Tiff') func withdraw(...) f1:init [p=G] [p=G] Python Tutor link self account_holder "Tiff" RV NoneThe Class Statement Global frame Account Account class func deposit(...) [p=G] func __init__(...) [p=G] func withdraw(...) [p=G] Account instance f1: __init__ [p=G] self account_holder RV "Tiff" None a max_withdrawal 10 __init__ deposit withdraw balance 0 holder “Tiff” class Account: max_withdrawal = 10 def __init__(self, account_holder): self.balance = 0 self.holder = account_holder def deposit(self, amount): ... def withdraw(self, amount): ... >>> a = Account('Tiff') Instance attributes Class attribute Python Tutor link
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有