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

Michael Hansen
Michael Hansen
8,369 Points

The test wants me to use `.join(", ")` but everywhere else I am reading that it should be (", ").join(sundaes)?

Having trouble getting through the last part of this quiz.

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

2 Answers

Steven Parker
Steven Parker
231,248 Points

The error message might be misleading.

It doesn't want you to use join with the arguments reversed, but it was guessing that you might have reversed them.

Your actual issues are:

  • you don't need to put parentheses around the string with the comma and space
  • you forgot that the challenge said "...reassign the menu variable..."

So after you remove the extra parentheses and assign the string you produce on the last line back to menu, you should pass.

Michael Hansen
Michael Hansen
8,369 Points

Thank you! This got me around the point I was stuck on. Just passed with:

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)

Steven Parker
Steven Parker
231,248 Points

Exactly right. :+1: But remember to use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down: