9. They're Multiplying!


My code works but gives me the error message "Oops, try again. Did you create an Animal() called sloth?"

class Animal(object):
    """Makes cute animals."""
    is_alive = True
    health = "good"
    def __init__(self, name, age):
        self.name = name
        self.age = age
    def description(self):
        print self.name
        print self.age
    hippo = Animal("Jake" , 12)
    sloth = Animal("Kyle", 10)
    ocelot = Animal("Frank", 5)
    print hippo.health
    print sloth.health
    print ocelot.health


creating instances (hippo = Animal("Jake" , 12))of an object should be after the object, not nested inside (remove the indent of the instance you are creating)


Take out all indentations after (print self.age)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.