Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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