A Methodical Approach - Weird result


#1



8. A Methodical Approach

So this code worked and python accepted it, but I don't understand why. I was expecting a much more clear result (current result shown below). Can anyone help explain what's happening?

<bound method Animal.description of Animal object at 0x7fb557197710
None


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("Roy", 26)
print hippo.description


#2

The output you are seeing is the location and details of the description method. To see the output of the method, it needs to be invoked.

hippo.description()

#3

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