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 trialRezwan Faruque
348 PointsStill can not get it .
Tried it 100 times but do not get the proper answer .It tells "oops! it looks like task 1 is no longer passed"
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes=available.split(";")
menu="our available flavors are: {} ."
display_menu = ", ".join(sundaes) menu = "Our available flavors are: {}.".format(display_menu)
2 Answers
Alexander Davison
65,469 PointsYou are close!
It seems to me you are mixing some stuff up.
Try this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = ', '.join(sundaes)
display_menu = "Our available flavors are: {}".format(menu)
How it works:
- The challenge made us a variable called
available
which is a string of available flavors separated by semicolons. - We make a variable called
sundaes
which is a list of the available flavors. We split by the semicolon to do this. - Then we join the
sundaes
list by a comma AND a space, not just a comma. We set that value tomenu
. If we didn't had the space themenu
variable would look like this (look at Figure 2 to see) - Finally we add the text "Our available flavors are: " to the beginning of the
menu
variable and set that value to thedisplay_menu
variable.
The final output will look like Figure 1.
Figure 1:
Our available flavors are: banana split, hot fudge, cherry, malted, black and white
Figure 2:
banana split,hot fudge,cherry,malted,black and white
As you see in Figure 2, there's no extra spaces after each comma. You have to explicitly say to add a space in the code.
I hope this helps.
Good luck
~Alex
Rezwan Faruque
348 Pointsstill error now it says it looks like Task 2 is no longer passing
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsTagging Kenneth Love
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherAlexander Davison I'm not sure why you're tagging me. The grader is working correctly. I don't need to be tagged to every post :)
Rezwan Faruque
348 PointsRezwan Faruque
348 PointsAt last I am able to do it. thank you for your help....
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsOh... Sorry. I thought Rezwan was still having issues with my code but I was pretty sure my code was correct so that's why I tagged you