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

Patrick Wagner
Patrick Wagner
5,259 Points

Receiving "Bummer! Didn't find the right series of sundaes and commas in `menu`" result, not clear whats wrong.

As stated, not sure what my error is. Running this same code in an interpreter via the workspaces seems to generate a correct sentence. If I am doing something wrong, its not clear to me and need it explained to me.

Thanks

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(';')

menu = "Our available flavors are {}."

newstring = ", ".join(sundaes)
menu.format(newstring)

2 Answers

Patrick Wagner
Patrick Wagner
5,259 Points

Thank you Vitto,

I see that the .format method does not modify the string in place, in fact as I type this I realize that strings are immutable and need to be re-assigned/declared after. IE menu = menu.format(newstring)

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Patrick.

If you click on preview, you will be able to see the current value of the menu variable. If you look close you will notice that you haven't modified its value, it still is the string with a placeholder (as a result of task 2/3).

You want to make sure you replace that value of menu.

Let me know if you need more help

;) Vitto