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 trialLinh Tran
177 PointsPlease explain the request:Use that string with a .format() on our existing menu variable and replace the current value?
I don't understand this question of code challenge: Challenge Task 3 of 3 It means i need to create a new menu, right?
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes=available.split(";")
", ".join(sundaes)
new_string="Menu includes:"+", ".join(sundaes)
menu="Our available flavors are: {}".format(",".join(sundaes))
menu=menu.format(new_string)
2 Answers
Chris Freeman
Treehouse Moderator 68,454 PointsYou are so very close. In your join
, a SPACE is needed after the comma:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes=available.split(";")
# ", ".join(sundaes) # <-- line not needed
# new_string="Menu includes:"+", ".join(sundaes)) # <-- line not needed
menu="Our available flavors are: {}".format(", ".join(sundaes)) # <-- added space
# menu=menu.format(new_string) # <-- line not needed
Linh Tran
177 PointsThanks for helping, Chris. I get the point now.
Scott Wysocki
2,222 PointsScott Wysocki
2,222 PointsHi, Chris.
The solution your provided isn't working for me. Here is the question asked in this task in full:
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'.
When I attempt to change the value of 'menu' as such:
menu = menu.format(", ".join(sundaes))
I am told that there wasn't the right series of sundaes and commas in "menu".
I noticed that when I use the code I just entered above, the string I'd get from ", ".join(sundaes) turns back into a list.
Any suggestions? Thanks