Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,862 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.