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 trialLee Border
4,093 Pointsmulti-dimensional list of musical groups. Really thought I had it..
I feel like this should be correct but I'm obviously missing something important
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))
Lee Border
4,093 PointsHi, The first challenge to loop through each group and output the members joined error comes up :
FAIL: test_output (main.TestLoopAndJoinExecution)
Traceback (most recent call last): File "", line 54, in test_output AssertionError: 'Ad Rock, MCA, Mike D.' not found in 'Ad Rock,MCA,Mi
Dave StSomeWhere
19,870 PointsPlease read the challenge carefully - do you see what you are missing?
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?
Your code outputs the following which is not quite correct:
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
Lee Border
4,093 Pointsword "space"... thank you I ended up overthinking where I was going wrong
Dave StSomeWhere
19,870 PointsGlad you found it, I would also take special note of what Tyler says below, error messages are your debugging best friends.
1 Answer
Tyler B
5,787 PointsAs Dave said you're missing a small piece of the challenge per its description. If you still need help your traceback error message may be able to help. AssertionError: 'Ad Rock, MCA, Mike D.' not found in 'Ad Rock,MCA,Mi
i.e.
you gave me
Ad Rock,MCA,Mike D.
I wanted
Ad Rock, MCA, Mike D.
Tyler B
5,787 PointsTyler B
5,787 PointsCan you post which one of the challenges you're trying to solve? What you're expecting to see vs what is actually happening when you run you code?