Welcome to the Treehouse Community
Looking to learn something new?
Morse code challenge - can't solve it!
I've been staring at this for a while now and have browsed other solutions within the Community pages but can't see what I've done wrong here.
I think continuing to stare at the code is unlikely to produce a different result so I could do with some help, please!
class Letter: def __init__(self, pattern=None): self.pattern = pattern def ___str___(self): output =  for c in self.pattern: if c == '.': output.append('dot') elif c == '_': output.append('dash') return "-".join(output) class S(Letter): def __init__(self): pattern = ['.', '.', '.'] super().__init__(pattern)
Steven Parker216,164 Points
Your code is fine.
You just have the wrong name for your method. You have "
___str___" (with 6 underscores), but the name should be "
__str__" (with 4 underscores).
That's very odd, though. In the IDE, there's two underscores each side so there must be some weird copy/paste issue that I created.
Thanks again - that'll give me something more interesting to stare at today!