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 Creating a Panda Class

Why code is not working here?

class Panda(): def initial(self, species, food): self.make = make self.model = model

print(Panda(‘Ailuropoda melanoleuca’, ‘bamboo’))
panda.py
# insert your code here

class Panda():
    def __initial__(self, species, food):
  self.make = make
  self.model = model

    print(Panda(Ailuropoda melanoleuca, bamboo))

1 Answer

Hi Hanwen!

How are you?

Well, I hope!

This is the way to code both tasks (to pass):

# insert your code here

class Panda:
    species = 'Ailuropoda melanoleuca' # Task 1
    food = 'bamboo' # Task 1

    def __init__(self): # Task 2
        self.is_hungry = True # Task 2

Even though using a print statement to see results in the real world is a good idea, adding one to the challenge code will break it!?!

Also, use init not initial...

I hope that helps.

Stay safe and happy coding!

Thank you Peter