Python Python Basics (2015) Python Data Types Use .split() and .join()

Jeremy Millar
Jeremy Millar
Pro Student 3,375 Points

going in circles pls help

The first 2 lines of code are correct according to the program, but on the next challenge when i add

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

The challenge tells me the first 2 lines are now incorrect. When i go back to them and check them again they are correct. I'm not sure how to get out of this circle, any help is very appreciated. :)
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}.".

1 Answer

Alex Koumparos
Alex Koumparos
Python Web Development Techdegree Student 35,919 Points

Hi Jeremy,

You've spotted one of the common quirks with Treehouse's challenge system. Often when you input code that doesn't pass the current challenge it will tell you that a previous task is no longer passing. This will lead you to wonder if there was something that changed in your previous lines. Nope. It's just the behaviour of the Treehouse parser. In this case, because you have a syntax error in line 3 of your code, Python can't interpret your script at all, so when it runs the tasks, even Task 1 can't output the required values.

Long story short, your problem is in the code you added for the current task, even though Treehouse is telling you that a prior task is no longer passing.

Which leads us to the obvious next question, what's wrong with your code for the current task?

Let's look at just the single line that has been added in the current task:

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

We can see that the reason you are getting a syntax error is that you have a trailing . in that line. Periods have particular semantic meaning in Python and they are a promise to the interpreter that the next code will be a method on the object that the period was attached to. Since you didn't supply a method but instead there was an end of file, Python exited with an error.

So to get the file to run, you just need to provide the method you were planning on using.

Hope that clears everything up