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

Dakota Brumfield
Dakota Brumfield
952 Points

Is my answer wrong, or just not the way i am being asked to write it?

i am on Task 3 of 3 and I believe I have the correct code written. I have tested my code in the Python Shell and it creates the string i believe the question is asking me to create.

is this a wrong answer all together or have I just written it in a way other than the way i am being asked to write it.

Outside of the code I have written I can not find another way to write it that creates the string I am being asked to create or that Treehouse will accept as an answer.

Here is what i have written,

available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(';')

menu = "Our available flavors are: {}."

display_menu = menu.format(', '.join(sundaes))

Any help is much appreciated.

Thank you in advance!

I hope you are all having a great day! -Dakota

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

1 Answer

Wesley Trayer
Wesley Trayer
13,812 Points

You're half of the way there!

"display_menu" is supposed to be equal to the sundaes joined by commas and spaces.

display_menu = ', '.join(sundaes)

Then "menu" is supposed to be reassigned to equal menu.format(display_menu)

Dakota Brumfield
Dakota Brumfield
952 Points

Thank you so much for your response!!!

So if I had just changed line 4 to read Menu = menu.format(', '.join(sundaes))

Then it would still yield the EXACT same result.

I do understand that i was creating the incorrect variable in trying to make "Display_menu" = The correct answer.

Thanks again for the help! -Dakota