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 trialmohan Abdul
Courses Plus Student 1,453 Pointswhy won't this return True?
Why won't this return True?
1 Answer
Steven Parker
231,236 PointsYou didn't mention which question you are asking about, but the one that gives most folks trouble has a class method that ends with "return has_pulp
".
This example is missing the "self.
" prefix before the name, which is needed to reference an instance variable.
mohan Abdul
Courses Plus Student 1,453 Pointsmohan Abdul
Courses Plus Student 1,453 Pointsits this:
Orange().squeeze() will return True. (So how should it be entered to return true?)
Steven Parker
231,236 PointsSteven Parker
231,236 PointsYes, that's the one. The last line is the problem, fixing it (which would make the question True) would look like:
return self.has_pulp