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 trialTafadzwa Mandimika
2,667 Pointsadd two arguments to your class in the __init__ method
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.
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
def __init__(self, name, age,):
self.is_hungry= True
self.name = name
self.age = age
2 Answers
Mel Rumsey
Treehouse ModeratorHi there. Tafadzwa Mandimika! You are super close!
You have an unnecessary comma after the age parameter. Once that is removed you should be able to move on to the next part.
Note: You may need to hit the restart button to clear any cached answers then type your answer in again.
Happy coding! :D
Mel Rumsey
Treehouse ModeratorAh okay I see what the other issue is. Somehow the space got deleted from
self.is_hungry = True
and became:
self.is_hungry= True
Makes sure you have a space on both sides of the equal sign :)
Tafadzwa Mandimika
2,667 Pointsthat worked , thank you alot hey :)
Tafadzwa Mandimika
2,667 PointsTafadzwa Mandimika
2,667 Pointshie Mel Rumsey ,thank you for the response... ive done as you advised im getting this error : Bummer: AssertionError: Regex didn't match: 'self.is_hungry\s=\sTrue' not found in "class Panda:\n species = 'Ailuropoda melanoleuca'\n food = 'bamboo'\n def init(self, name, age):\n self.is_hungry= True\n self.name = name\n self.age = age" : The instance attribute should be set with self and equal to True.