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

Atharva Surve
Atharva Surve
555 Points

Didn't understand the error" Didn't find the right series of sundaes and commas in `menu`"

What mistake am I doing here? Also, can somebody explain the following line" Then reassign the menu variable to use the existing variable and .format() to replace the placeholder with the new string in display_menu."

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

2 Answers

Steven Parker
Steven Parker
231,007 Points

You're almost done, just one thing left to do.

That part about "reassign the menu variable" means to put the formatted string back into the menu variable. When you call format on a string, it creates a modified version but it doesn't change the original string. So if you want the original string changed (as we do here), you need to make an assignment to put the new string back into the variable.

And when you make an assignment, you put the thing being assigned on the left, then an equal sign ("="), then the expression that creates the value you want to assign:

menu = menu.format(display_menu)
Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're actually doing terrific and incredibly close. In fact, the key to problem here lies in the very instruction you inquired about.

Then reassign the menu variable to use the existing variable and .format() to replace the placeholder with the new string in display_menu

What they mean is to reassign the resulting formatting of the menu with the display_menu back into the original menu variable. At the end of your code, you format the menu with the display menu. But that formatting is sort of hanging out in limbo. You never assign the results anywhere nor print them. So although you did it, there is no result.

Hint: Your last line should begin with menu =

I feel like you can get it with these hints, but let me know if you're still stuck! :sparkles: