[Tutor] Class, input

jason hochstein bigapple631 at optonline.net
Sat Aug 21 21:41:50 CEST 2004


 Hello,alI. am trying to get this program to allow the user to enter the money amounts and I also need it to stamp the date each time it returns info at the end.


class 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

a = Account(1000.00)
a.deposit(550.23)
a.deposit(100)
a.withdraw(50)

print a.getbalance() 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040821/aa6917ad/attachment.htm


More information about the Tutor mailing list