Python Python Basics Python Data Types Use .split() and .join()

Dakota Brumfield
Dakota Brumfield
951 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
5,291 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
951 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