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 trial
Maciej Walczak
5,042 PointsUse split() and join() Challenge problem
Instruction: 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.
after doing as instructed i keep getting this error: Oops! It looks like Task 1 is no longer passing.
my code:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
menu = menu.format(sundaes.join(", "))
1 Answer
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsHi Maciej
see below
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}." #you could have called format method here directly
menu = menu.format(sundaes.join(", "))# You cannot call the method join on a list, the join method is part of the string class
# my code
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}.".format(", ".join(sundaes))
happy coding
Maciej Walczak
5,042 PointsMaciej Walczak
5,042 PointsThanks a million Andreas! Now i see my mistake. I do have another question for you. Could you please explain to me how did you insert in your post "script like window", so i can in the future format my posts here correctly?
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsAndreas cormack
Python Web Development Techdegree Graduate 33,011 PointsClick the link below to the Markdown Cheatsheet and it explains how to achieve this.