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 trial

Python

iterable: "what am i doing wrong

class Letter: def init(self, pattern=None): self.pattern = pattern

def add(self, pattern): 
    self.pattern.append(pattern)

    def __len__(self):
        return len(self.pattern)

    def __contains__(self, item):
        return pattern in self.pattern

    def __iter__(self):
         yield from self.pattern

    def __str__(self):
        output = []
        for blip in self.pattern:
            if blip == '.':
                output.append('dot')
        else:
            output.append('dash')
    return '-'.join(output)

class S(Letter): def init(self): pattern = ['.', '.', '.'] super().init(pattern)

Steven Parker
Steven Parker
229,732 Points

Please post a link to the course page you are working on.

Steven Parker
Steven Parker
229,732 Points

Congratulations! :+1: If you think it might help other students, you could still post that link and an explanation of the fix. Or if you don't need the question you can delete it (click the little rectangle with the 3 dots to reveal the option, but only after you delete the "answer" the same way).

1 Answer

thanks i figured it out :)