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 trialTanaka Pendeke
1,095 PointsAlright, let's finish making our menu. Combine the sundaes list into a new string, joining them with a comma and a spac
need help...thanks in advance
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes=available.split(";")
menu="our available flavors are: {}."
3 Answers
Steven Parker
231,261 PointsIt looks like you've already completed tasks 1 and 2 — good job so far!
Now you may want to review the Splitting and Joining video. There's a good example of what needs to be done for task 3 starting at time index 4:50.
I'll bet you can figure it out without an explicit spoiler.
Drew Butcher
33,160 PointsI think you are looking for this:
menu="our available flavors are: {}.".format(', '.join(sundaes))
Good code to know actually, I did something similar to this in a web application last week.
Steven Parker
231,261 PointsGive a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime.
― Maimonides
Thomas Helms
16,816 PointsI think the issue comes from the wording of the directions. It makes it sound like we are actually doing two/three steps:
- Combine sundaes into a new string
- Do menu.format()
- menu=menu.format()
It could probably changed from: Combine the sundaes list into a new string, joining them with a comma and a space (", "). Use that string with a .format() on our existing menu variable and replace the current value of menu.
To: In the menu line, use .format() and .join() to make the sundaes list into a string, with a comma and a space (", ") as separators.
Still a little awkward, but you get the idea.
Steven Parker
231,261 PointsIt can be done as three things. But it can also be abbreviated as you suggest (and as shown in the video).