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 trialAkhila Jana
Courses Plus Student 577 PointsHow do I edit an existing string variable by using the variable name?
I'm trying to change the string value by using the variable name. But the value seems to be unaffected.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}".format(sundaes)
display_menu = ", ".join(sundaes)
menu = menu.format(display_menu)
1 Answer
Steven Parker
231,275 PointsI'm not sure which variable you are referring to. But from the standpoint of the challenge, you did a little bit too much on the third line. You don't need "format" there, just assign the template string by itself to "menu".
Everything else looks good, so with that change you should pass the challenge.
Akhila Jana
Courses Plus Student 577 PointsAkhila Jana
Courses Plus Student 577 PointsI want to modify menu variable. I want to display string separated by commas instead of a list
Steven Parker
231,275 PointsSteven Parker
231,275 PointsThe "join" line makes a string separated by commas instead of a list, and puts it into "display_menu". Then the final line uses that string on the template and puts the final string into "menu".