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!
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
plz help can't understand what to do to pass tihs question?
i'am trying to solve this from past 2 days but i'am unable to pass plz help me with your code ...
class Letter: def __init__(self, pattern=None): self.pattern = pattern @from_string def create_dash(cls,string): string_list =  str = string.split("-") for element in string_list: if element == "dash": string_list.append("-") else: string_list.append(".") def __iter__(self): yield from self.pattern def __str__(self): output =  for blip in self: if blip == '.': output.append('dot') else: output.append('dash') return '-'.join(output) class S(Letter): def __init__(self): pattern = ['.', '.', '.'] super().__init__(pattern)
Steven Parker228,001 Points
You're getting close, but there's a few issues yet:
- the new method is named "create_dash", but the instructions ask for one named "from_string"
- the method is marked as "@from_string" but the instructions ask for a "@classmethod"
- "dash" is converted to a hyphen ("-") but the instructions say to make them underscores ("_")
- the method should return a new instance with the created pattern loaded