Python Object-Oriented Python Advanced Objects Frustration

Mathew Yangang
Mathew Yangang
Python Web Development Techdegree Student 4,433 Points

not sure why my code is not passing

I have to return the wrong result , but my code not passing
class Liar(list):
    def __len__(self):
        result = super().__len__()
    return result * 3

1 Answer

Steven Parker
Steven Parker
168,640 Points

I see two issues:

  • the "return" is not indented far enough to be considered part of the method
  • this won't always return a wrong value. If the real length is 0, this will also return 0.

Hint: to be sure to be wrong, try adding instead of multiplying.