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

zaki azizi
zaki azizi
421 Points

Alright, let's finish making our menu. Combine the sundaes list into a new variable named display_menu, where each item

please someone help me. I'm stuck.

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

2 Answers

Alex Koumparos
MOD
Alex Koumparos
Python Web Development Treehouse Moderator 33,475 Points

Hi Zaki,

On the line where you declare menu. The challenge is only asking for you to create the base string, not to add the .format() piece. By using format() and putting your own sundae flavour in this, you've populated the {} and it won't be available for when you later want to pass your display_menu as the list of sundaes.

On the line where you declare the display_menu variable, you don't want the menu. If you take that out, you'll have a valid declaration in the form required.

Then to complete the challenge you need to combine what should be in the menu variable with your new display_menu variable. You've shown that you know how to use the .format() concept, so here is where you want to apply that, but you want to give it display_menu instead of your flavour.

Hope that clears everything up,

Cheers

Alex

zaki azizi
zaki azizi
421 Points

Thank you very much my dear Friend. that was very helpful.

Then reassign the menu variable to use the existing variable and .format() to replace the placeholder with the new string in display_menu.

available = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(';') display_menu = ", ".join(sundaes)

How do I complete this task?

"Our available flavors are: {}".format("".join(display_menu))

I've done this and it works on workspace but not on the task.