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 trialtenzin dodhon
388 Pointsplease tell me how to solve this question
i have done it like this first i have made a new variable name= display_menu=("apple, banana") sundaes + ", ".join(display_menu)
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes= available.split(";")
menu="Our available flavors are: {}.".format(,)
display_menu=("apple, baba, milk shake)
sundaes + ", ".join(display_menu)
1 Answer
Alexander Davison
65,469 PointsI think you over-thought this question.
All you need to do is:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = sundaes.join(", ")
display_menu = "Our available flavors are: {}".format(menu)
- First I split the
available
variable by semi-colons and assign that to a variable calledsundaes
. - Next, I join the elements in
sundaes
by separating by ", " and assign that value tomenu
. - Last, I add the message "Our available flavors are: " to the beginning of
menu
and assign that to the final variabledisplay_menu
.
I hope you understand what's going on :)
Good luck! ~alex