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!

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

Eric Morales
Eric Morales
844 Points

Intro to lists


I am having trouble with this task using python. The challenge wants me to loop through the lists and add ", " between each member. Below I have the code I used.

for member in musical_groups: print(member, ", ")

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 member in musical_groups:
    print(member, ", ")

1 Answer

Steven Parker
Steven Parker
224,936 Points

Consider using the "join" function to convert a list into a string with a specific separator sequence.

Also, the choice of the variable name "member" might be a bit confusing because the code stores an entire group (list of members) into it.