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 trialScott Jones
5,397 Points.Orange().squeeze() == false
Quiz Question 3 of 5 "
class Orange(Fruit):
has_pulp = True
def squeeze(self):
return has_pulp
Orange().squeeze() will return True. "
The quiz says this is false. I don't understand why. Any insight would be much appreciated :)
3 Answers
Steven Parker
231,198 PointsThe "squeeze" method is not coded correctly.
When referencing a class property, the name must be prefixed with "self.
", which was not done here. Based on the code shown, the global "has_pulp" being referenced here may not be defined, or if it is, it's value is unknown.
Scott Jones
5,397 PointsI was totally overlooking the syntax. I thought I was missing some concept on parent classes. Thanks lol
Scott Jones
5,397 PointsOops. firstpost thanks again!
aditya yadav
1,505 Pointsaditya yadav
1,505 PointsAlso Fruit class is undefined
Steven Parker
231,198 PointsSteven Parker
231,198 PointsFor the purpose of the quiz question, I think you're supposed to assume that
Fruit
is defined elsewhere.