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

Jerry Wayne
Jerry Wayne
287 Points

Challenge task 3 of 3

I am not sure what is wrong with my code.

I am having a hard time understanding what it is that they want me to do for this challenge.

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

4 Answers

Stuart McIntosh
Stuart McIntosh
Python Web Development Techdegree Student 8,232 Points

Hi there this is a confusing challenge. My suggestion, dont use display_menu. Concentrate on using format and join combined on menu.

available = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(';') menu = "Our available flavors are:{}.".format(sundaes) display_menu = "Our available flavors are:{}." .format(", ".join(sundaes)) its perfect one I have checked it on python compiler but dinnt know why treehouse tutor not passing it and proceeding it

Stuart McIntosh
Stuart McIntosh
Python Web Development Techdegree Student 8,232 Points

hi there, this is a confusing challenge - below is the answer they are looking for.

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

sundaes = available.split(';')

menu = "Our available flavors are: {}.".format(', '.join(sundaes))

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