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()

Lost

I am lost as to what the next answer is

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

2 Answers

Keep in mind that Python is very picky! Apparently you have an extra space between the first { and the closing }.

Also, you just left out a stray = which will cause a Syntax error.

Third, the challenge asked you to assign menu to the sundaes list with each element joined with a comma and a space (to create a string).

Fourth, you didn't call the format() function on the last string, so Python doesn't know what to do with the {} in the string, so it leaves it as it is (It doesn't replace the {} with anything). In this situation, the challenge wants you to format in the newly modified menu variable.

Lastly, since code challenges are also picky, you should remove the extra period . at the end of the last string.

Complete code:

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

P.S: I edited my code so it's not sundaes.join(', ') but so it is ', '.join(sundaes). I know it's weird, and I mistake this all of the time.

I hope this helps :grin:

~Alex

If this helped you, please mark it as a best answer! Thanks!

I have tried this and it's still not working. I know I am missing something silly

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