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

Task 1 is no longer passing

without changing task 1 or 2 - when I go to check my work on task three it says Task 1 is no longer passing. i repeat the process giving differrent answers and reloading the page but the same thing continues to happen

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

2 Answers

Steven Parker
Steven Parker
230,995 Points

You're really close, but I see two issues. First, "join" is the opposite of "split" in that it is a string method that takes a sequence as an argument. So you need two swap those terms around. It may look a bit strange until you get used to it.

Then, when you apply format to "menu", you still need to assign the result back to "menu".

Fix those and you should have it!

thanks for your help!

I see where I went wrong re:"join" - display_menu = ", ".join(sundaes)

but I'm not sure what it means to "reassign" the results of the "format" back to menu.

Steven Parker
Steven Parker
230,995 Points

Your last line produces the correct result string, but doesn't put it anywhere. To reassign the results back to menu that last line should begin with "menu = ".

Thank Steven! - I'm just getting used to all the terminology - I was thinking it was something much harder than it was. thanks again :)

Christian A. Castro
Christian A. Castro
30,501 Points

xuanye You only need to fix the last two sentence of your code..

For example:

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

sundaes = available.split(';')

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

display_menu = ", ".join(sundaes)

menu = 'Our available flavors are: {}.'.format(display_menu)

It should works perfectly fine on your end!

Thanks Christian!