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

Why is this code not working?

I have tried this code in Visual Studio Code and it's working fine.

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:
    print(", ".join(group))

for group in musical_groups:
    if len(group) == 3:
        print(", ".join(group))

It is not working in the editor of treehouse so now I can't finish the challenge.

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,857 Points

Hey there,

You do have it!

However, this is just one of those cases where the 'normal' rules for challenges need to be ignored. Normally each task's code would be added to the previous task, but that is not the case here.
The instructions for the second task are a bit ambiguous when it come to this, but they do actually mean to alter the code from task one to output what is wanted for task two.

Here you have the correct code needed, so if you just completely delete the first for loop and leave the second for the second task, it will pass.

Either task, there should only be one loop coded.

Nice work!! :) :dizzy:

tagging Craig Dennis to have a look to see if instructions could be clarified. :)

Hi Jason,

Thank you for clarifying!

I think it's a good idea to clarify the question a bit. :)