9. They're Multiplying!



Traceback (most recent call last):
File "python", line 1, in
File "python", line 13, in Animal
NameError: name 'Animal' is not defined

I'm not even sure where to start with this error. When I go back to the previous exercises that I passed with the exact same code, I now get this error. Something seems to be wrong with Codeacademy.

While I was writing this code, I could submit it a couple times and I got various other errors, but now that I think my code is correct, I'm getting this one. What gives?

class Animal(object):
    """Makes cute animals."""
    is_alive = True
    health = "good"
    def __init__(self, name, age):
        self.name = name
        self.age = age
    # Add your method here!
    def description(self):
        print self.name
        print self.age

    hippo = Animal('barf', 100)
    sloth = Animal("tark", 19)
    ocelot = Animal("doge", 56)
    print hippo.health
    print sloth.health
    print ocelot.health


check your indentation.instances should be outside of Animal class


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