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

Code challenge sundae menu building.

Hello im really struggling to get my head around python. Im not sure on how to set this up properly

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

[MOD: added ```python formatting -cf]

3 Answers

Steven Parker
Steven Parker
243,656 Points

You didn't link to a challenge, but just looking at your code I noticed this: You can't use "menu" in the join call because it hasn't been defined yet (it will be after that line).

:point_right: I think you meant to put "sundaes" there.

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

Does that solve your issue?

Sorry its the first time i have asked a question. Im still getting an error, Its saying "Did you use .join(", ")?"

You was right i just needed to change a mistake i made in the code. Thanks Steven.