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

Joining and Spliting - Please help

Hey there!

I've started not a while ago learning Python and I have encountered with a small difficulty during my studying. I'm at the end of the task, and I am asked to: "Combine the sundaes (as a str) list into a new string, joining them with a comma and a space (", "). Use that string with a .format() on our existing menu variable and replace the current value of menu (as a str)."

I've tried several ways to answer the question - but no luck. I'd like to hear an explantion about the question - I'n not quit sure what they are want from me.

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

1 Answer

Steven Parker
Steven Parker
230,248 Points

Your answer appears to be correct. :+1:

So I tested it by cutting and pasting it directly into the challenge — and it passed!

If it didn't pass for you, perhaps there was some glitch. Retry, and paste it in from the above.

Hi! thank you for your answer!

Sorry I wasn't clear enough - the code i wrote which is attached to the question are from the previous tasks - the task I need help with the task 3 out of 3, which I don't understand what they mean.

thanks again!