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

splitting and joining

challenge task 3

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

1 Answer

"display_menu" spelling... update the menu variable.

Check the below code for more details.

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 the question when the teacher says 'existing variable' is he referring to the current variable. What I mean is, whenever you read 'put the x variable into the existing variable' is the programmer referring to x? I hope this is clear.

Existing variable means, 'any variable that is already existing in the current context and do not make a new variable'.

Now it could be 'x' or some other variable. We'll have to understand and fill in the blanks by ourselves and figure out, to which variable we need to assign the value.

Now in above example, challenge-task-3: Then reassign the menu variable to use the existing variable and .format() to replace the placeholder with the new string in display_menu.

Here existing variable is referring to the same variable menu. Also, assigning it to menu makes sense, and that's how i understood its menu, that is to be assigned the new value, besides the point that it says 'reassign' menu variable. :)