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

Seamus Hannan
Seamus Hannan
509 Points

"Task one no longer works", but it does when I run through it again, and my code works in workspaces.

I must be missing something nitpicky in the tutorial setup, but I have no idea what it is. When I run the final code line it says either "task on no longer works" or something, or "Bummer! did you use ".join(",")" which isn't even the correct syntax I thought. ( ", ".join(sundaes) is what I was taught, and is, in fact, in there.)

This has become super frustrating.

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))
Seamus Hannan
Seamus Hannan
509 Points

When I run this step-by-step in workspaces it works fine

1 Answer

Umesh Ravji
Umesh Ravji
42,386 Points

Hi Seamus, you can just replace the display_menu variable at the end with menu to make sure that the final result is assigned to the menu variable.

# Simple change to existing code:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
menu = menu.format(", ".join(sundaes))

# More verbose way (not required):
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
display_menu = ", ".join(sundaes)
menu = menu.format(display_menu)
Seamus Hannan
Seamus Hannan
509 Points

it worked, but how come I can just ignore their request for a display_menu variable when they are such sticklers about everything else?

Umesh Ravji
Umesh Ravji
42,386 Points

If you're really brave, you can even accomplish this all on the same line where menu is currently being set.

I think it's just something that the powers that be decided in this case :)