Noah Fields13,985 Points
Object-Oriented Python, Code Challenge: Frustration, help
I am attempting the code challenge in Object-Oriented Python known as "frustration". True to its name, this is quite a tough challenge, and it involves creating a subclass of list called "Liar" with a redefined len() command which gives the incorrect value. What I find to be problematic here is that I somehow need to get the actual len() value at some point during this program, so that I can change the number to something which I can know with certainty is not accurate. I attempted to briefly use super().len() but to no avail, perhaps due to incorrect syntax. Are there any suggestions on the proper way to get the true len() value of a given variable in such a situation?
class Liar(list): def __init__(self, *args, **kwargs): for x in self:
Chris FreemanTreehouse Moderator 55,471 Points
There are parts to this challenge:
- create a
class Liarthat is a subclass of
- create a
__len__method (which will override the inherited version). Only
- call the parent
Post back if you need more help. Good Luck!!