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

challenge instruction question.

Hi so in the instruction: "Here is a multi-dimensional list of musical groups. The first dimension is group, the second is group members." So my question is: Which one is the group and which one is the group members in the given list? or what do they mean by "The first dimension" ???

Thanks

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

1 Answer

John Lack-Wilson
John Lack-Wilson
8,181 Points

Hey judeokain, thanks for your question, multi-dimensional lists can get awkward and complex very quick, so hopefully I can help in explaining them.

A multi-dimensional list is a list of lists, i.e. say if I had one huge box, and I filled it with lots of other boxes, I would have a box of boxes, right? And If were to fill those boxes with more boxes, I would have a box of boxes of boxes, and so on... So a multi-dimensional list is a list containing multiple lists. Specifically in this challenge it is a 2 dimensional list (a list of lists).

The first dimension is referring to each list within the musical_groups list, meaning that each of these lists forms a group. In this particular example, think of it as each opening bracket '[' means the start of a new group, and the closing bracket ']' is the end of that group.

The second dimension refers to the list of individual members of a particular group.

Heres an example:

musical_groups[1] is the Beatles (because lists are 0-indexed) and the members of the Beatles are John Lennon, Paul McCartney, Ringo Starr, and George Harrison. If we were to assign a variable with musical_groups[1], we would creating a single-dimension list containing the names of members of the Beatles.

the_beatles = musical_groups[1]

print(the_beatles[0])

The above print statement would give us "John Lennon".

I hope that helps, feel free to comment and ask any further questions.

Ohhhh! I get it now. Thanks a lot!