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 trialTinotenda Emmanuel Nyamukapa
5,127 Points__len__ is not giving me the correct answer
this code seems to be giving me an error please help
class List:
class Liar(List):
def __init__(self, item):
self.item = list
super().__init__(item)
def __len__(self, list):
return len(list) + 3
1 Answer
Steven Parker
231,269 PointsYou've got the right idea, but a few issues with the implementation:
- you don't need to define "List"
- "Liar" will be based on "list" (lower-case)
- you don't need to override "__init__"
- the override of "__len__" doesn't need an argument
- use "super()" to access the "__len__" of the parent class, and it won't need an argument