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 trialStudent5 Saxon
2,525 PointsWhy does it say task one is no longer passed if it is?
Why? Just, WHY????
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}".format(sundaes.join(", "))
3 Answers
Steven Parker
231,248 PointsYou get that message anytime you introduce a syntax error.
Since the challenge re-tests task 1 first, a syntax error will cause it to fail.
In this case you have applied join to a sequence and given it a string argument, but join is actually a string method that takes a sequence argument.
Kenneth Love
Treehouse Guest TeacherEach time you submit code for the code challenge, all of the previous steps are re-run. So when you submit task #3, the challenge engine runs task #1, then task #2, then, finally, task #3. So if code you wrote in task #3 breaks task #1, you'll get the error message that you got. I added a bit of extra error checking to help people find the problem you encountered.
But let's talk about what happened in your code. It's a very common mistake. You're doing sundaes.join()
, but sundaes
is a list and the .join()
method belongs to strings, not lists.
Student5 Saxon
2,525 PointsWhy does it work if instead I put "string".format(", ".join(sundaes)) if sundaes is still a list?
Kenneth Love
Treehouse Guest TeacherThat's how join
works. It's a method that belongs to strings. ", "
is a string. So ", ".join()
says "take this string and use it to combine everything in this list". The list that's being joined is sundaes
.