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!

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

Why am I being told Task 1 is no longer passing?

I'm on task 3 of the .split() and .join() challenge and I'm being told that task 1 [sundaes = ";" .split(available) ] is no longer passing. I'm trying to make sense of this. My task 3 answer might be incorrect, but if my task 1 answer wouldn't work, why did it work in task 1? Or am I misinterpreting this message?

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

1 Answer

Charlie Gallentine
Charlie Gallentine
12,092 Points

When you reassign menu in the last line, you don't need to concatenate the ", ".format(display_menu), .format() can just be tacked onto the end of the text string. I generally treat the "test # is no longer passing" as a general error saying that something is wrong with the current code.

Additionally, when you call the .split() method on available, the method is called on the string and the break variable goes in the parameters of the method. The join method is opposite to this and written how you have it in the display_menu line.

Hope that helps!!!

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

sundaes = available.split(";") #Splits the 'available' string on the semi-colons

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

display_menu = ", ".join(sundaes) # Regroups sundaes into string of words separated by comma-space (", ")

menu = menu.format(display_menu) # Formats the string into the curly braces on 'menu'
Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi Charlie! I have turned your comment into an "Answer" so that it marks the question as answered on the forums and allows for voting on your answer. Thanks for helping out in the Community! :sparkles:

Also, Charlie is correct about the "Task <number> is no longer passing". Most often this indicates a syntax error in your current code so that it can no longer be compiled/interpreted. It is not the only reason, but it is definitely the most common.

This was incredibly helpful. Thank you so much for saving my sanity!