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
MOD
Michael Hulet
Treehouse Moderator 46,682 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