[Tutor] Class question

Timothy Wilson wilson@visi.com
Thu, 29 Jun 2000 16:14:50 -0500 (CDT)


On Thu, 29 Jun 2000 masoga@mail.com wrote:

> I read the tutorial several times and tried to run the examples in the tutorial but I get an error can someone explain to me what am I donig wrong!!
> Here is the class file:
> 
> class BankAccount:
> 	def _init_(self, initialAmount):
> 	self.balance = initialAmount
> 	print "Account created with balance %5.2f" %self.balance

You need to indent your statements following the def. For example,

class bankAccount:
    def __init__(self, initialAmount):   # notice the number of underscores
        self.balance = initialAmount
        print "Account created with balance %5.2f" % self.balance

-Tim

--
Tim Wilson      | Visit Sibley online:         | Check out:
Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/
W. St. Paul, MN |                              | http://slashdot.org/
wilson@visi.com |   <dtml-var pithy_quote>     | http://linux.com/