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

Girish Rao
Girish Rao
10,549 Points

Challenge Task 3 of 3

I am not getting question .What do they want me to do.No sample output is given here.

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

2 Answers

Tianni Myers
Tianni Myers
10,453 Points

They want you to split the available string and join them to the menu string where {} is, separated by a comma. You can test the output with print(menu).

available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(';')

menu = "Our available flavors are: {}.".format( ", ".join(sundaes))
Stuart Wright
Stuart Wright
41,120 Points

The error message you are getting is 'Task 1 is no longer passing'. Task 1 requires that the sundaes variable is a list, but you have reassigned it on your 4th line. You should rename this new variable on your 4th line to something else. Make sure you also use this new name when you reference it on line 5.

You also need to use ", " rather than simply "," as the join string on line 4.

Finally, on line 5, the final result should be held in the menu variable, not display menu.