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 trialOmar Abu Hamdan
794 Pointsbanana.py
what is wrong with my code?
available = "banana split;hot fudge;cherry;malted;black and white"
available.split(";")
sundaes=available.split(";")
menu="Our available flavors are: {}"
sundaes.join(", ")
display_menu=sundaes.join(", ")
menu.format('display_menu')
1 Answer
Tom Slutsky
12,453 Pointswell we have couple of issues here. first of all there is no need to call twice to split, neither to join. Both of these methods do not change the input but instead return a new object (list or string).
the real issue though is the join method is used incorrectly. the join method is used on a string object and gets a list as an argument; that means you should use
(', ').join(sundaes)
one more thing is that by calling
menu.format('display_menu')
you are not assigning the formatted string to the variable menu you should probably "prepare" all your variables prior to declaring the menu variable and then call
menu = "Our available flavors are: {}".format(display_menu)
I think this is it