Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Basic Object-Oriented Python Welcome to OOP Adding to our Panda

I dont understand anything in this question

Using your Panda class, add two arguments to your class in the init method called name and age. Set the values inside of the init method using self.

panda.py
class Panda:
    species = 'Ailuropoda melanoleuca'
    food = 'bamboo'

    def __init__(self):
        self.name = "Timmy"
        self.age = 16
        self.is_hungry = True

3 Answers

it means that you have to add a 'name' and 'age' parameters to the init function, like so:

def __init__(self, name, age):

"Set the values inside of the init method using self." this means that when an instance of this class is made you have to provide these values for the instance of this class i.e.

timmy_the_panda = Panda(name='timmy', age=15)

here you created an Panda instance of your, let's say panda zoo where there is a unique panda with a name and age.

You give instances unique values when initialized like so:

def __init__(self, name, age):
    self.name = name
    self.age = age

Hope this helps!

class Panda: species = 'Ailuropoda melanoleuca' food = 'bamboo'

def __init__(self, name, age):
    self.name = name
    self.age = age
    self.is_hungry = True

class Panda: species = 'Ailuropoda melanoleuca' food = 'bamboo' def init(self, name, age): self.name = name self.age = age self.is_hungry = True