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

No idea what this code is even trying to ask me to do...

yeah as states, no idea.

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

2 Answers

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,736 Points
  • you need to call the join() method on the string and pass in the list as the argument, not the other way around
  • they want you to call .format() on the menu variable and pass in display_menu as an argument. You can't do that until after you've assigned the display_menu variable. So the way they're describing it is to assign the menu variable twice, once where we set its value to "Our available flavors are: {}.", and then again later on where we call .format() which will substitute "{}" for a value, in this case you'll pass in `display_menu'.

Let me know if you have more questions.

Hey John,

you are doing great. In the 3rd line of your code, you are missing a closing paranthesis after the "format(". So, the menu variable declaration would look something like this:

menu = "Our available flavors are: {}.".format()

Also, at the display_menu variable, you want it to join the items in sundaes by a ", ", not the other way around. So it would look something like this:

display_menu = ", ".join(sundaes)