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

Carlos Marin
Carlos Marin
8,009 Points

Class object calling.

Can someone give us a detailed explanation for, why the statement on the bottom is False?

Thank you in advanced.

Carlos A. Marin

class Orange(Fruit):
    has_pulp = True

    def squeeze(self):
        return has_pulp

Orange().squeeze() will return True.

1 Answer

Steven Parker
Steven Parker
229,732 Points

Since it doesn't have a "self." prefix, the "has_pulp" being returned by the "squeeze" method is either undefined, or it is a global for which the value can't be determined from the code shown.