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 trialCarson Evans
1,016 PointsTotally lost here.
not sure what the question is asking or how to organize this. Plus I only recognize 2 names of the artists to the groups so I'm not sure if I knew which item goes where if that would help me organize it. Or maybe the name to group coreelation has nothing to do with the answer. Either way I am not sure what this is asking.
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
print(musical_groups)
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsIn this challenge, the "groups" or "bands" are not explicitly named. The instructions could be rewritten as:
Here is a multi-dimensional list of unnamed musical groups. The first dimension is the unnamed group, the second is members of the group.
Can you loop through list of groups and output the group's members joined together with a ", " comma space as a separator, please?
So likely elements you'll need:
- a
for
loop to get at each unnamed musical group - a way to
join
the member of the group into a comma-space separated string - a
print
to output each string after it's complete
Post back if you need more help. Good luck!!
Carson Evans
1,016 PointsCarson Evans
1,016 PointsIs this close to the right answer? (the print() is indented underneath the first line.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsItβs getting close. HINT: you can join all the members of a list using:
β, β.join(some_list)