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 trial

Python Object-Oriented Python Inheritance Inheritance Quiz

Henry Lin
Henry Lin
11,636 Points

Why is Orange().squeeze() is False?

Let's say the Orange() is an instance of class Orange(I don't know if we can create an instance with the same name as class) then the instance should be able to access any method and attribute in that class. Hence, Orange().squeeze() should return has_pulp which it's default value is True.

On the other hand, let's say we can't have an instance that has same name with class, then this code segment should give us exception(error).

All in all, either way, they code should return an error or True. But Why the answer is False ?

1 Answer

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

It doesn't return False. It's a 'true or false' question about whether it will return True. The 'True' and 'False' in the options are not directly referring to the return value, they're referring to the logic of the question.

This code throws an error, so which is not returning True, so the answer to the question is False.

It's kind of a confusing question.