On 4/4/2010 11:11 AM Shurui Liu (Aaron Liu) said...
Sorry, let me specify. I think comptuter will print out those two
sentences like this:


It's a little more interesting as you move forward from here. This is a small step...

class Critter(object):
    """A virtual pet"""
    def __init__(self,name):
        print "A new critter has been born!"
        self.name = name
    def talk(self):
        print "\nHi.  I'm %s, an instance of class Critter." % self.name


# main
crit1 = Critter('Polly')
crit2 = Critter('Spot')

crit1.talk()
crit2.talk()

HTH,

Emile

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to