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 Python Basics (2015) Python Data Types Use .split() and .join()

Can't find out the way to reach the goal. Plz help

Plz have a look into the solution i have given and tell me what is the thing i'am wrong at , which is not working enough to let me pass this task?

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

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great and you have the syntax down pretty much. However, there's a problem here that's causing a syntax error. Remember, you may not use a variable before you have given it a value.

On line 3 of your code, you're trying to format the menu with display_menu. But at this point in your code, display_menu hasn't been defined. You don't define it until line 4. Simply changing the order of line 3 and line 4 corrects this. Your line #3 should be the one that starts with display_menu and your line #4 should be the one that starts with menu =.

Hope this helps, but let me know if you're still stuck! :sparkles:

thanx ma'am