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!
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
Grayden KelloggPython Development Techdegree Student 1,826 Points
Joining items in a multi-dimensional list.
Not sure where to go from here.
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 group_members = ", ".join(musical_groups) for groups in musical_groups: print(group_members)
Steven Parker228,001 Points
Here's a few hints:
- notice that "musical_groups" is a big list of smaller lists
- if you looped through the big list, your loop variable would hold a smaller list
- you could then join and print each smaller list
I still can't get this to work correctly, my approach is if the index is an odd number then join it with the other values of an odd index but that works in code but it fails the question, I was also trying to pass the index number to a function I defined which worked but didn't pass the challenge? Is there only 1 right answer for this?