Python Object-Oriented Python Advanced Objects Frustration

hello I need some help

I don't how do this

frustration.py
class Liar(list):
    def __init__(self, *args, **kwargs):
        super().__init__()

    def __len__(self):
        return len(self) - 2

1 Answer

Steven Parker
Steven Parker
167,904 Points

You have the right idea, but to call the "len" method of the parent class, you need to put "super()." in front of it. Otherwise, you're calling yourself which will cause a "recursion loop".

Also, don't forget the underscores for the name "__len__".