ClassesThe class statementclass Account: def __init__(self, initial): self.balance = initial def deposit(self, amt): self.balance = self.balance + amt def withdraw(self,amt): self.balance = self.balance - amt def getbalance(self): return self.balance |
<<< | O'Reilly OSCON 2000, Introduction to Python, Slide 92 July 17, 2000, beazley@cs.uchicago.edu |
>>> |