Alexander BesseFront End Web Development Techdegree Student 16,570 Points
The error only says "Bummer: Try again!"
class Letter: def __init__(self, pattern=None): self.pattern = pattern def __str__(self): string = '' for item in self.pattern: if item == '.': string += 'dot-' elif item == '_': string += 'dash-' return string[:-2] class S(Letter): def __init__(self): pattern = ['.', '.', '.'] super().__init__(pattern)
Steven Parker153,143 Points
You are very close! The one issue is that a slice stops just before the end index, and doesn't include it. So you want to slice up to the last character instead of the 2nd to last: