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 trialAizah Sadiq
2,435 PointsI don't know where I am going wrong
Please help me with joining 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 groups in musical_groups:
groups.join(",")
print(musical_groups)
3 Answers
Mark Sebeck
Treehouse Moderator 37,799 PointsThe 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))
Aizah Sadiq
2,435 Pointsso for the separator, do I put it in quotation marks and brackets?
Mark Sebeck
Treehouse Moderator 37,799 PointsJust quotes. The brackets are for the print statement.
Aizah Sadiq
2,435 PointsI'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))
Jerry Avila
5,523 Pointsif you add an "s" to group in the first line of code it should fix it.