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 trialPeter Mercado
8,066 PointsLost
I am lost as to what the next answer is
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = "Our available flavors are: { } ."
display_menu =
2 Answers
Alexander Davison
65,469 PointsKeep in mind that Python is very picky! Apparently you have an extra space between the first { and the closing }.
Also, you just left out a stray =
which will cause a Syntax error.
Third, the challenge asked you to assign menu
to the sundaes
list with each element joined with a comma and a space (to create a string).
Fourth, you didn't call the format()
function on the last string, so Python doesn't know what to do with the {} in the string, so it leaves it as it is (It doesn't replace the {} with anything). In this situation, the challenge wants you to format in the newly modified menu
variable.
Lastly, since code challenges are also picky, you should remove the extra period . at the end of the last string.
Complete code:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = ', '.join(sundaes)
display_menu = "Our available flavors are: {}".format(menu)
P.S: I edited my code so it's not sundaes.join(', ')
but so it is ', '.join(sundaes)
. I know it's weird, and I mistake this all of the time.
I hope this helps
~Alex
If this helped you, please mark it as a best answer! Thanks!
Peter Mercado
8,066 PointsI have tried this and it's still not working. I know I am missing something silly
available = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(';') menu = ', '.join(sundaes) display_menu = "Our available flavors are: {}".format(menu)