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

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

This exercise seems bugged or there isn't enough info to complete it to the desired effect.

FYI - I tested my code out using python's REPL on my computer and it appeared to output the desired result. Also, preview does seem to work with this lesson.

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

3 Answers

Then what is the purpose for " Combine the sundaes list into a new variable named display_menu" in the instructions? I'm sorry but the instructions either should be changed or the answer needs to be changed.

andren
andren
28,558 Points

That refers to the second longer solution, this line:

display_menu = ", ".join(sundaes)

Combines the sundaes list into a new variable named display_menu. As I said the challenge description is not as clear as it could be, mainly about the fact that you have to replace the menu variable's contents. But at the same time the instructions are not wrong either. All of the things they ask you to do is part of the challenge's answer.

Yes, I struggled with this as well. Ended up skipping over it.

I tried to use the "preview" option, but, it's not very intuitive, ie, helpful.

andren
andren
28,558 Points

The challenge isn't bugged, but the challenge text can be somewhat misleading. You are not the first person I've seen make this exact mistake. The problem is that the task wants the formatted menu to replace the contents that is currently stored in the menu variable, not the display_menu variable. There are multiple ways of doing this but there are two intended solutions, the short solution alluded to in the challenge text is this:

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

The longer solution that is intended to be a bit simpler is this:

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

In that example you separate the joining of the sundaes to a separate variable, but ultimately you are still setting the menu variable equal to a formatted menu, that is the part of this exercise that is mandatory. And that is the thing you are not doing in your own code.

Bad content is bad content. The lesson is at the beginner level and if I was a beginner I'd be rather discouraged. If someone were to ask me to recommend a online course to learn python I'd be reluctant to recommend this this course.