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 exactly the same... but still an error message

Once again, I get the error message that Task 1 is no longer passing, when I have not changed anything in Task 1. It would be great to receive feedback on my errors in order for me to learn something... instead, the programming (ironically) doesn't work properly.

I'm starting to hate this.

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

2 Answers

Steven Parker
Steven Parker
229,644 Points

One quirk about the multi-task challenges is how they re-check all the previous tasks in order. This can get confusing if you have done something (such as introduced a syntax error) that invalidates the entire program. That causes all tasks (starting with the first) to fail.

In this case, the new third line has several syntax errors:

  • it seems to have two separate assignments on the same line
  • the "format" method (which is for strings) is being applied to a list
  • there is a stray string following the "format" call
Samuel Ferree
Samuel Ferree
31,722 Points

Looks like you just have some syntax errors.

First, Don't make an assignment in your template string, do that before

Second, you want to join the list of sundaes, not format them

Third, To use template strings in python, you don't need to quotes (") inside the curly braces ({}, also pre-pend your string with an f

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

Thanks for the response - your suggestion still isn't working though? Now it says "Didn't find the right series of sundaes and commas in menu."

Steven Parker
Steven Parker
229,644 Points

The challenge is apparently not designed to recognize the new format strings. The instructions also explicitly mention using ".format()".

Samuel Ferree
Samuel Ferree
31,722 Points

Python 3.6 has format strings, it's version of template literals.