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

It looks like Task 1 is no longer passing

hello, just stuck on this and not sure what i'm what i'm doing wrong. i know it's probably something minor and obvious...face palm btw, does the pink font mean anything?

"Alright, let's finish making our menu.

Combine the sundaes 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."

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

When Task 1 no longer passes, check your newly added code for syntax errors.

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

task 2 = sundaes = available.split(";")

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

3 Answers

Hi Patrick, assuming you're on Task 2 when this occurs, make sure you don't include the period at the end of the string, because that period is intended to end the sentence, not to be included in the value for the menu variable.

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

If you're on Task 3, remember that the join method is "text to join between items".join(list_of_items_to_join) which is the reverse of the string.split("text") method.

Hope that helps!

Hi Evan.

I'm up to task three. i've passed through the first two. i'm sorry, i still don't really understand. here is an overview of what my code looks like at the moment. i decided to type it out since i don't how to copy/paste the code itself:

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

task 2 = sundaes = available.split(";")

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

so yeh, that's what my code currently looks like, i keep getting an error on task three.

You're so close on this one! You just need to reverse the order on the join method.

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

For help formatting posted code, you can also check out this link.

hey patrick

so in the lesson edit kenneth was saying you have to first make the string then pass in what you're going to join the new string with in the parameter in this case we're doing the comma so it would be

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

Edit: Don't forget that space with the comma!

hope this helps you, guy

ahh! okay, i see. thanks a lot evan and darrian. really appreciate it :)

no problem!

dont forget to marked this as solved