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

Combine the sundaes list into a new string, joining them with a comma and a space (", ").

Don't know what i'm doing wrong

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(";")

menu = "Our available flavors are: {}." 

2 Answers

Hi Steve, on the last task, you have forgotten to format in the joined version of sundaes. .join() can be used on a string to join a list together with each item seperated by that string:

available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(";")

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

Thanks, Haider

What does .format do?

.format allows you to format something into the curly braces in a string. For example, if i had the following string:

message = 'Hello my name is {}'

you could put your name into the string by calling format on it.

print(message.format('Haider'))

This would give you the following message:

'Hello my name is Haider'