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 trialNico Romero
1,365 PointsCant seem to figure out how to join
I cant seem to figure out how to join menu with display menu, I have taken sundaes and split it with (", ") at least I think I did that correctly, but I can seem to join them though I reassigned menu and tried to use .format() to input display_menu's list
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}.".format(display_menu)
display_menu = sundaes.join(", ")
3 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsYour are close. join()
is a str
method. It operates on a string which will be the text separator between the list elements in the argument to produce a new string.
display_menu = ", ".join(sundaes)
Read it as use this string ", " to join the elements of the list argument sundaes
and return the new string.
Nico Romero
1,365 PointsThank you Chris, So would that be the same thing for the .format as wel? or is that a totally different thing?
Chris Freeman
Treehouse Moderator 68,441 PointsIt is the same in that format()
is also a string method that returns a new string.
Nico Romero
1,365 PointsNever mind, I figured it out.haha Thank you so much Chris :)