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

Amadeus Carnegie
Amadeus Carnegie
2,501 Points

How do I make a list out of multidimensional music groups?

I'm not sure where to go from here, do I need to in some way do an extra step to join each individual line into a string or something?

If somebody could write the correct code with an explanation that would be much appreciated!

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
group_number = 1
for group in musical_groups:
    print("{}, ".format(group))
    group_number =+ 1

2 Answers

Ryan Bailey
Ryan Bailey
824 Points

I took Steven's advice along with your original code and believe I was able to output what the assignment is looking for:

for members in musical_groups:
    print(", ".join(members))
Steven Parker
Steven Parker
229,967 Points

You might want to consider using "join" instead of "format". Also, nothing in the instructions requires you to create any new variables (like "group_number").