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 trialIan Darby
1,455 PointsWhy doesn't this work?
It says task 1 is no longer passing.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
display_menu = sundaes.join(', ')
menu = 'Our available flavors are: {}.'.format(display_menu)
3 Answers
Keifer Joedicker
5,869 Points.split asks you at what character you would like to split the text. The character you use can be though of as a 'format' for which .split will use to divide up the variable or string. The format is called inside the parenthesis.
available.split(';')
.join also has a character that is used as a sort of format for how you would like to manipulate the data provided. But unlike .split the format is specified before the data you want you manipulate.
display_menu = ', '.join(sundaes)
See the difference?
And for the final step:
You can have a variable with the assigned data and than reference that later on.
display_menu = ', '.join(sundaes)
menu = "Our available flavors are: {}.'.format(display_menu)
or you can call the .join method inside the format method itself.
menu = Our available flavors are: {}.'.format(', '.join(sundaes))
Keifer Joedicker
5,869 PointsChris Freeman, i'm not sure what you mean.
Chris Freeman
Treehouse Moderator 68,457 PointsYour answer was entered as a comment below the OP. So I moved it from being a comment to being a regular answer.
Thanks for your help in answering questions!
Kevin Morris
1,058 PointsAhh! Thank you that has been driving me nuts. I was making the exact same mistake!
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsChange comment to answer
Ian Darby
1,455 PointsIan Darby
1,455 PointsThank you so much!