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 trialnikel Hayo
1,943 PointsI did not understand at all. which ones are group names and which ones are group members?
I did not understand at all. which ones are group names and which ones are group members?
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
3 Answers
Cameron S
20,537 PointsTry thinking of it like this:
musical_groups
is a list that holds 7 different lists. Each of the 7 lists inside the musical_groups
list, contains the names/ members of an unnamed group, like so:
# second dimension lists
['Ad Rock', 'MCA', 'Mike D.'] . # 1
['John Lennon', 'Paul McCartney', 'Ringo Starr', 'George Harrison'] # 2
['Salt', 'Peppa', 'Spinderella'] # 3
['Rivers Cuomo', 'Patrick Wilson', 'Brian Bell', 'Scott Shriner'] # 4 (Rock on Weezer!)
['Chuck D.', 'Flavor Flav', 'Professor Griff', 'Khari Winn', 'DJ Lord'] # 5
['Axl Rose', 'Slash', 'Duff McKagan', 'Steven Adler'] # 6
['Run', 'DMC', 'Jam Master Jay'] #7
I got this list by iterating over the musical_groups
list:
for group in musical_groups:
print(group)
Hopefully, this helps clarify some of the questions you have and gets you started down the right path. Good luck!
Steven Parker
231,275 PointsThere are no group names in this data. The list "musical_groups" contains other lists, and each of those contain the names of group members.
If you view the organization as two dimensions, "The first dimension is group" but there's no data for each group other than the list of its members.
nikel Hayo
1,943 PointsThanks to both of you.