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 trialHassan Baukman
2,288 PointsTask three is not working for me. When I run it in a Python shell it works. Is there a problem with this task?
also I don't know how you can complete the last sentence of task three on the same line.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes=available.split(';')
menu = "Our available flavors are: {}".format(sundaes)
display_menu = (", ").join(sundaes)
2 Answers
Katie Wood
19,141 PointsHello there,
It looks like the task is asking you to print out the display_menu rather than sundaes, which means you'll need to declare that on the line before 'menu', and then switch it out in the 'menu' definition. That would look something like this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
display_menu = ', '.join(sundaes)
menu = "Our available flavors are: {}.".format(display_menu)
The shorter solution, though, is to do the join on the same line as menu, like the challenge says. You mentioned being curious about how to do that - basically, it's just skipping the display_menu variable altogether, and performing the join right on the menu line, inside .format. That looks like this, and should also pass:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = "Our available flavors are: {}.".format(', '.join(sundaes))
Hope this helps!
Hassan Baukman
2,288 PointsThank you for your response it was very helpful.