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

Daniel Kondakov
Daniel Kondakov
1,337 Points

I provided the "is hungry" argument, but am getting an error that I did not provide a positional argument

I cannot figure out how to fix this error

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

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

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hey Daniel Kondakov 👋

The error happens because your __init__ method is defined to take an is_hungry parameter, while the challenge asks for only having the self argument. Since you're initializing is_hungry to be True anyway you can simply remove the parameter. This adjustment should pass the challenge as expected 🙂

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

    def __init__(self):
        self.is_hungry = True

Hope this helps! 😁