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

Aleksandra Laska
Aleksandra Laska
5,343 Points

Please help me !

What is wrong in here ? :D

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
for group in musical_groups:
    print( ", ".join(group))
    if len(musical_group) = 3:
        print(musical_group)

3 Answers

Clayton McDaniels
Clayton McDaniels
5,788 Points

Can someone explain the instructions for what the instructor is asking for?

Here is a multi-dimensional list of musical groups. The first dimension is group, the second is group members.

Can you loop through each group and output the members joined together with a ", " comma space as a separator, please?

Clayton McDaniels
Clayton McDaniels
5,788 Points

I understand the multi-dimensional list of musical groups. However, the question he/she is asking for us to loop through and the output requested is what I do not understand.

Some hints for task 2:

  • You can use the print statement from task 1. No need to create another. Although it will have to be indented.
  • Since you are looping with group you will want to check the length of group
  • Use the comparison operator not the assignment operator when testing the length
  • Your if statement should come before your print statement (from task 1)
Clayton McDaniels
Clayton McDaniels
5,788 Points

Why do you need to perform the step below?

-Since you are looping with group you will want to check the length of group-

@Clayton McDaniels checking the length is for task 2