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 trialMark Baek
1,172 PointsGetting error message "Didn't find the right series of sundaes and commas in `menu`.", yet my code works in the shell
So this is the code I put into shell:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}"
", ".join(sundaes)
menu.format(", ".join(sundaes))
//I do this because simply using the .join() command doesn't seem to save the edit to the variable.
This results in the following string:
'Our available flavors are: banana split, hot fudge, cherry, malted, black and white'
Is that not correct? Yet any time I submit this I'm told the right series of sundaes and commas are not found despite previous tasks passing without issue.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
", ".join(sundaes)
menu.format(", ".join(sundaes))
2 Answers
Daniel Gauthier
15,000 PointsHey Mark,
Line four is where you're going wrong. Try adding the .format to the end of the third line.
The following code passes:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = 'Our available flavors are: {}.'.format(', '.join(sundaes))
Good luck!
Daniel Gauthier
15,000 PointsHey Mark,
You can definitely add menu.format() after the fact, but the way listed above keeps your code as short as possible and keeps you from having to add additional lines.
Good luck!
Mark Baek
1,172 PointsMark Baek
1,172 PointsOh, I see. Thanks!
I was under the impression that I could use menu.format() to edit the variable, without the need to use 'menu ='
Chris Freeman
Treehouse Moderator 68,454 PointsChris Freeman
Treehouse Moderator 68,454 PointsOr be sure to reassign
menu
in the last line:menu = menu.format(", ".join(sundaes))