Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types Use .split() and .join()

In this assignment, I get the required output in python, but your quiz doesn't accept it.

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

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

display_menu 'Our available flavors are: banana split, hot fudge, cherry, malted, black and white.'

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

4 Answers

I submitted the following and it seemed to work - I agree it was a bit ambiguous either way as to what we were expected to do with the comment about being able to 'do the whole thing on one line'... especially considering that by adding

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

I suppose in a practical sense it makes it so that we will get the same answer, regardless of if we reference menu or display_menu

Robert Schaap
Robert Schaap
19,836 Points

Though it's the same thing, the challenge is asking you to set display menu first, and then on a separate line re-assign menu. Like so:

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)

Of course you could also just add .format to the line where you're declaring menu for a nice one liner :)

Thanks.:)

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,986 Points

The challenge is looking for the updated menu. You can use something like

menu = menu.format(....)

Post back if you need more help. Good luck!!!

Antonio De Rose
Antonio De Rose
20,882 Points
#yes it will not, am glad, that you are trying in both ways, that you have something like a source truth, to
#check against one another
#the reason it is not giving, is the questions, are really picky, and strict, that you do what it asks, regardless
#of the outcome
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = "Our available flavors are: {}."
display_menu = menu.format( ", ".join(sundaes))# issue is here, where the question, asks to reassign to the menu variable

# you've done more that great, with what is needed, to check against a python env