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 trial
Ben Thrower
1,760 PointsI cannot get part two on the final Introducing Lists Challenge with the musical groups in the groups.py file.
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: new_group = (", ".join(group)) print(new_group)
The first part is fine. It's the second part I can't get.
for group in musical_groups: if len(group) == 3: print(group)
I also tried this:
'''for group_members in new_group: if len(group_members) == 3: print(new_group)
And this
len_new_group = len(new_group) if len_new_group == 3: print(len_new_group)
And this, among other things
for group in musical_groups: print(", ".join(group))
for group_members in group: if len(group_members) == 3: print(group)'''
btw Weezer was just here last week and I missed it
1 Answer
Steven Parker
243,160 PointsIt's a bit hard to read all the unformatted code, but I think you're getting the tasks confused. For task 2, you just need to add the conditional to test the length, you don't print the length.
You still print out the joined members (the "new_group") just like you did in task 1, but now you only do it for groups of the right size.