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 trialAshish Anand
1,556 PointsEven after making a class called Panda with two attributes the output throws an error saying that self is not needed.
As you can see from the code I have created a class called Panda with two attributes called species and food, but the error says that self is not needed for instantiating an object of the class Panda.
class Panda:
species=Ailuropoda melanoleuca
food=bamboo
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsHey Ashish Anand, The "self" error is part of a larger generic error message and does not apply to your code.
The real error is plainly stated before this. The species
and food
are not defined because the assigned string values are not within quotation marks. This leads to a syntax error, so the entire code is non-functioning.
Remember to a space is expected before and after an '"=** sign.
Post back if you need more help. Good luck!!
Ashish Anand
1,556 PointsAshish Anand
1,556 PointsHi Chris,
Your right! I changed the variable assignment part with "" and with proper spacing. It worked!!