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()

Louis Pirkis
Louis Pirkis
1,963 Points

Task 3: I think I am getting a syntax error. I can't use the format function with display menu or join.

Task 3, using line 4: I think I have a syntax error with the format function. I can't insert the display_menu here, or join sundaes here within the format function.

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

1 Answer

Hello Louis,

You're missing a . between "Our available flavors are: {}." and format(", ".join(sundaes)) [1]. On the same line, you're also re-evaluating ", ".join(sundaes), despite having assigned the value of this expression to the display_menu variable; you should pass this variable as the argument to the format() function to avoid redundant coding.

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

Good Luck