They're Multiplying! 9/18


#1



Guys where is my fault ? I couldn't find it. Is there a bug ?
When I clicked submit , the error message showed up : Oops, try again. Make sure to give your Animal class a health member variable.


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


#2

As part of your definition of Animal, you use Animal
It doesn't make sense to do so yet, because you haven't defined Animal

You're likely getting an error message about this in the console, you need to take care of that before you can consider what codecademy is saying

That is, your code crashes, so yeah, your Animal class has no such attribute because the class doesn't exist at all, your program crashed before it could create it.


#3

thx. I resolved. my fault was written inline :))


#4

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