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 Advanced Objects Frustration

Oprea Mihai
Oprea Mihai
5,592 Points

I'm not a good Liar

Although I'm trying I'm not a good Liar. Can someoane help me :) ?

frustration.py
class Liar(list):
    def __len__(self):
        new_len=super().__len__()
        return new_len*2

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

You may not be a good liar, but you're a good jokester and a good programmer :) You have the right idea, but you forgot to account for one mathematical gotcha. When the list is empty (len(list) == 0), multiplying by 2 will still return the correct value of 0, because anything multiplied by 0 is still 0. You can play with this however you want, but I recommend adding some arbitrary constant as part of your equation