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 trialshawn007
15,408 PointsI don't think this is covered in the previous video.
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
def __init__(self,is_hungry=True):
self.is_hungry = is_hungry
Getting an error stating that I'm suppose to have only one attribute called self.
So how do you set is_hungry=True? Above code is all i got from the previous video.
# insert your code here
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
2 Answers
Steven Parker
231,271 PointsThe instructions say that your method "should only take the self argument", but this code gives it two arguments instead.
Also, the Markdown code to indicate formatted lines is 3 accents (```), not apostrophes (''').
shawn007
15,408 PointsSteven,
You are correct. I must of misspelled something. I revisited the test and it work without pass.
Shawn
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
def __init__(self):
self.is_hungry = True
shawn007
15,408 Pointsshawn007
15,408 PointsSteven,
Thanks for the 3 accents.
I figured it out. I forgot the importance of the 'pass' keyword within the init method. This allowed me to only take the self argument without getting unwanted errors. The previous video didn't mention this. So luckily I still had notes from past videos on 'pass'.
Shawn
Steven Parker
231,271 PointsSteven Parker
231,271 PointsI'm not sure why you'd need "pass" here. If I just take your original code and remove the 2nd argument, and then change the assignment to use "True", it passes the challenge.