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

I can not get the class Panda to work...

I have been trying this for half an hour now and I cant get it to work, I need help.

panda.py
class Panda:
    def __init__(self, species='Ailuropoda melanoleuca', food= 'bamboo') :
        self.species = species
        self.food= food

Create a class called Panda. Inside your class, create two class attributes. One called species set to โ€˜Ailuropoda melanoleucaโ€™ and another called food set to โ€˜bambooโ€™. These are the instructions.

1 Answer

boi
boi
14,242 Points

You've given keyword arguments to the __init__ method. You're supposed to set the attributes inside the class block. Try to makes this change, if the problem persists, let me know.

I was overthinking by a ton, I just reviewed the video and tried to find a simpler solution a and it worked thank you.