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 trialYasser Shaaf
UX Design Techdegree Student 13,865 Pointskindly help us in the first challenge
kindly help us in the first challenge
1 Answer
Lorenzo Minto
13,898 PointsAlright hope this helps.
You first need to split the given string into a list by using the split function and giving the split function the separator you want to consider: in this case ";". The code should look like this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
For the second task you need to format the list items into a string by using the ({}).format(input) syntax. The code should look like this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}".format(sundaes)
And finally for the final task you should use the join method. Just make sure to follow the right syntax which is: joined_string = separator.join(sequence). Exchanging the separator with the sequence is a very common mistake so make sure to remember the right order. The final code should look something like this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}".format(", ".join( sundaes ))
Hope this helped.