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

Sean Flanagan
Sean Flanagan
33,235 Points

Use .split() and .join(), Task 3

Hi.

I can't work out where I've gone wrong on this last line. Please advise.

Thanks

Sean

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

2 Answers

"desserts" isn't an existing variable.

Since you haven't defined that variable yet, it will cause an error. Try changing "desserts" to "menu". :)

Good luck! ~Alex

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Alex.

Thanks for trying to help.

I tried this:

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

I got the reply:

 Bummer! Didn't find the right series of sundaes and commas in `menu`.

I'd appreciate any further help on offer.

Sean

Hmm... That's weird. I tested out your code with desserts as menu in the Python Shell, and it worked just fine. Maybe try combining the last two lines into one (this does the same thing but sometimes code challenges expect you to do it that way)?You code should look like this when you "combine" lines:

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

Good luck!

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Alex. That worked absolutely perfectly. Thanks for your help.

Sean :-)

I'm happy It helped! ~Alex