What is wrong here?


#1



https://www.codecademy.com/courses/python-intermediate-en-WL8e4/1/3?curriculum_id=4f89dab3d788890003000096#


Oops, try again. It seems like your code raises an error, see the console window for the error message!
Traceback (most recent call last):
File "python", line 12, in
AttributeError: 'Animal' object has no attribute 'description'


class Animal(object):
    """Makes cute animals."""
    is_alive = True
    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("Harry", 18)
hippo.description()


#2

Hi the description method should be inside the class Animal


#3

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