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 trial

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

sorry

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = "Our available flavors are : {}. ".flavors(available)
Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Senadin Beganovic

Please provide a Appropriate Title and a informative description of the issue you are having in the body of the post. Repeating letters are like gibberish and do not provide other students any information about your post. This is not appropriate posting etiquette and leads to the Treehouse Community looking cluttered and unprofessional.

Please make the appropriate corrections to your post.

Thank you for your cooperation.

Jason Anders ~Treehouse Community Moderator

1 Answer

First thing you never defined anything for flavors, not that it is needed. Replace it with format, and the variable with the split of your string.

menu = "Our available flavors are : {}. ".format(sundaes)

But this is not quite right. Your output is : Our available flavors are : ['banana split', 'hot fudge', 'cherry', 'malted', 'black and white']. You split function changed the string into a list of the flavors. This is where the .join will be used.

menu = "Our available flavors are : {}. ".format(", ".join(sundaes))

This will join the list values together, with a comma between the items. Now your menu will be - Our available flavors are : banana split, hot fudge, cherry, malted, black and white.