Python Python Basics Python Data Types Use .split() and .join()

Aananya Vyas
Aananya Vyas
7,966 Points

this isnt working.. telling me to go back to task 1 for some reason!!??

Alright, let's finish making our menu. Combine the sundaes list into a new variable named display_menu, where each item in the list is rejoined together by a comma and a space (", "). Then reassign the menu variable to use the existing variable and .format() to replace the placeholder with the new string in display_menu. If you're really brave, you can even accomplish this all on the same line where menu is currently being set.

this is the question ^

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
display_menu =sundaes.join(",")
menu = menu.format(sundaes) + display_menu

1 Answer

Reyam Marcos
PRO
Reyam Marcos
Pro Student 10,365 Points

Hi, hope this helps

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)