8. Methodical Approach


#1

I got the correct code for this excercise but i was wondering if someone could please explain why we dont add name, age as arguements for the description function
code is as follows:

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): #why dont we add name and age
        print self.name 
        print self.age 
hippo = Animal("Yeezy", 20)
hippo.description()

thanks in advance


#2

The self argument gives the function access to other descriptors. By using self, (dot notation) then it knows all your attributes.