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 trialEthan Pyles
2,710 PointsI am getting an AssertionError. I feel that I might not completely understand what the assumptions are for the output.
I enjoy music groups and their members possibly more than anyone that I know. The arrangement in this table where each row is a group and the group name is contained in column one seems logical. I begin to find familiarity in the table but John Lennon as a group name?
I faintly think that I understand properly, but please help me out.
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
members=[]
for group in musical_groups:
print("Group Name: ",group[0])
print(group[0], "Members:")
members=", ".join(group[1:])
print(members)
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsThe AssertionError is coming from the checker. These assertions mean a test comparison failed. Look deeper into the comparison to see where the error may be.
You seem to be over complicating the task.
- the join should be over all members of the group. The first item isnβt the group name.
- you can remove the first two print statements withIn the function definition
Post back if you need more help. Good luck!!!
Ethan Pyles
2,710 Pointsmusical_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
members=[] for group in musical_groups members=", ".join(group[0:]) print(members)
Chris Freeman
Treehouse Moderator 68,441 PointsFor clarity, group[0:]
is the same as group