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

Jeremy Millar
PLUS
Jeremy Millar
Courses Plus 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. :)

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

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 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

Cheers

Alex