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

Why is python unable to find the right series of sundaes in "menu"?

The problem I am having is with line 4, where I don't know whether I am incorrectly using .format or .join in this code. Any assistance with an explanation would be very much appreciated.

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

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're actually doing great. So, I'm just going to give a hint here. You don't actually need a line 4. You should be tacking on the .format() part to the end of line 3 :smiley:

Hope this helps! :sparkles:

Thanks for the help

Anish Palan
Anish Palan
3,157 Points

Hello, I think that the rule for using format is to use it in the same line as you initialise the string along with the {} parantheses. So in your case as Jennifer hinted out you need to add the .format((", ".join(sundaes))) to the end of line no 3. Hope that helps