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

Can not finish question. There seems to be an error in the base code somewhere that I can not debug.

I am trying to answer the question but no matter how clean my code is there is an error. Even without my code and just the template alone an error code is thrown. I am not sure what to do. Either I am missing something or there could be an embedded error somewhere.

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"],
]

The code I put in does not matter. The code wont run as it with just the predefined list. There is a bug somewhere. It fails to run even when all the code is commented out. Here is the code, its works just fine when I plug it into workspace.

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

Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 Points

The test will fail if there is no appropriate code to replace the # Your code here.

What code have you tried to use as a reasonable attempt at the solution?

Here is the code

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

This would be the output. As far as I can tell I am doing exactly what the question asks. Out put the groups members separated by a comma.

group
['Ad Rock', 'MCA', 'Mike D.'],
group
['John Lennon', 'Paul McCartney', 'Ringo Starr', 'George Harrison'],
group
['Salt', 'Peppa', 'Spinderella'],
group
['Rivers Cuomo', 'Patrick Wilson', 'Brian Bell', 'Scott Shriner'],
group
['Chuck D.', 'Flavor Flav', 'Professor Griff', 'Khari Winn', 'DJ Lord'],
group
['Axl Rose', 'Slash', 'Duff McKagan', 'Steven Adler'],
group
['Run', 'DMC', 'Jam Master Jay'],

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

Your answer is not far off. The challenge asks Can you loop through each group and output the members joined together with a ", " comma space as a separator, please?

Your code prints out the group list. Can you add a step to join the list into a string?

Post back if you need more help. Good luck!!!