Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Darrin Spell Jr
Full Stack JavaScript Techdegree Student 10,303 PointsHelp with Task 2 please and thank you in advance.
Not sure what exactly I am doing wrong to cause the AssertionError: print("I feel like I am missing something important") print("Please explain as clear as possible")
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 musical in musical_groups:
musical = ", ".join(musical)
print("{}".format(musical))
if len(musical_groups) == 3:
print(", ".join(musical_groups))
2 Answers

Cameron S
20,147 PointsAssertions are a systematic way to check that the internal state of a program is as the programmer expected, with the goal of catching bugs. In particular, they're good for catching false assumptions that were made while writing the code, or abuse of an interface by another programmer. Read more on Assertion use here
In your second code block
if len(musical_groups) == 3:
print(", ".join(musical_groups))
muiscal_groups
is a list containing lists of 7 different musical groups. Therefore, the len()
of musical_groups
is 7. You need to move your if
statement inside your for loop
to "print out the trios". See below:
for musical in musical_groups:
if len(musical) == 3:
print(", ".join(musical))

Darrin Spell Jr
Full Stack JavaScript Techdegree Student 10,303 PointsThank you sir. So I was just had to loop it?