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 trialAngel Miranda
2,434 Pointsits throwing an assertion error but everything looks like it should be where its at.
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
is_hungry = True
def __init__(self, name, age):
self.name = marty
self.age = 45
1 Answer
Steven Parker
231,269 PointsThere's a couple of issues:
- no variable named
marty
has been created, but you don't need it because... - the init should store the values that come in as the arguments instead of using literals
Angel Miranda
2,434 PointsAngel Miranda
2,434 Pointsso I have to write functions for each value? I tried writing self.name, self.name(), self.name(name), self.name = name, and self.name = "name" within the function. I also tried writing name="name" within the parameters but it keeps throwing the same error.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsI'm not sure what you mean by "functions for each value", but the code above is very close. You just need
name
instead ofmarty
. Then you need to make a similar fix for the age.Also, don't change the part of the code that sets "is_hungry", just leave that as provided.
Angel Miranda
2,434 PointsAngel Miranda
2,434 PointsI changed Marty to name and 45 to age but it still throws the same error.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsAnd did you also put the code that sets "is_hungry" back to how it was when the challenge started?