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 Introducing Lists Build an Application Multidimensional Musical Groups

I don't know where I am going wrong

Please help me with joining this

groups.py
musical_groups = [
    ["Ad Rock", "MCA", "Mike D."],
    ["John Lennon", "Paul McCartney", "Ringo Starr", "George Harrison"],
    ["Salt", "Peppa", "Spinderella"],
    ["Rivers Cuomo", "Patrick Wilson", "Brian Bell", "Scott Shriner"],
    ["Chuck D.", "Flavor Flav", "Professor Griff", "Khari Winn", "DJ Lord"],
    ["Axl Rose", "Slash", "Duff McKagan", "Steven Adler"],
    ["Run", "DMC", "Jam Master Jay"],
]
# Your code here
for groups in musical_groups:
    groups.join(",")
    print(musical_groups)

3 Answers

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 37,777 Points

The join method in Python is confusing. You have it backwards. It's

separator.join(iterable)

Also notice that they want a space after the comma. So the separator would be ", ". You are then printing the original list. You want to print what the join method just returned. You want

print(", ".join(groups))

so for the separator, do I put it in quotation marks and brackets?

Mark Sebeck
Mark Sebeck
Treehouse Moderator 37,777 Points

Just quotes. The brackets are for the print statement.

I'm still having issues with this

musical_groups = [
    ["Ad Rock", "MCA", "Mike D."],
    ["John Lennon", "Paul McCartney", "Ringo Starr", "George Harrison"],
    ["Salt", "Peppa", "Spinderella"],
    ["Rivers Cuomo", "Patrick Wilson", "Brian Bell", "Scott Shriner"],
    ["Chuck D.", "Flavor Flav", "Professor Griff", "Khari Winn", "DJ Lord"],
    ["Axl Rose", "Slash", "Duff McKagan", "Steven Adler"],
    ["Run", "DMC", "Jam Master Jay"],
]
# Your code here
for group in musical_groups:
    ", ".join(groups)
    print(", ".join(groups))

if you add an "s" to group in the first line of code it should fix it.