They're Multiplying!- 9


Traceback (most recent call last):
File "python", line 16, in
AttributeError: 'str' object has no attribute 'health'

Oops, try again. Did you create an Animal() called sloth?

It should be printing out the health of each animal.

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

print 'hippo'.health
print 'sloth'.health
print 'ocelot'.health


you should store your instances in variables


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