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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Harjan Anand](https://secure.gravatar.com/avatar/9dff410b4174fc18623c42dd5a3a163c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Harjan Anand
780 PointsHow do you only print out the trios for this challenge?
I find it confusing
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))
![Harjan Anand](https://secure.gravatar.com/avatar/9dff410b4174fc18623c42dd5a3a163c?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Harjan Anand
780 PointsThis is my code am i doing good so far: or group in musical_groups: print(", ".join(group)) if: len(group) = 3
![Harjan Anand](https://secure.gravatar.com/avatar/9dff410b4174fc18623c42dd5a3a163c?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Harjan Anand
780 PointsI know its not right but i am just asking is the form right: for group in musical_groups: if = 3: print(", ".join(group))
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 Pointsif = 3:
is missing the conditional expression before the comparison, and should use ==
4 Answers
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsHey Harjan Anand, you can find the length (number of members) using the len() function. Using len(group)
returns an integer value.
Post back if you need more help. Good luck!!!
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsAn if statement can be used of the form:
if <condition>:
print(...)
where <condition>
might be len(group) == 3
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsThe form should be:
for ...
if ...
print(....
![Evelyn Meza](https://secure.gravatar.com/avatar/336e8b5137e5ef4ebd06b303377a37f1?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evelyn Meza
4,226 Pointsfor group in musical_groups:
if len(group) == 3:
print(group)
what am i doing wrong?
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsThe join
function needs to be reused from Task 1. As it is now, the group is printing as a list.
Post back if you need more help. Good luck!!!
![Evelyn Meza](https://secure.gravatar.com/avatar/336e8b5137e5ef4ebd06b303377a37f1?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evelyn Meza
4,226 Pointsprint(join.(group))
in this gesture? i tried this and another. Also thank you so much for being attentive to answering!
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsUse the same print statement as Task 1. See OP code, above, for example. “, “.join(group)
![Evelyn Meza](https://secure.gravatar.com/avatar/336e8b5137e5ef4ebd06b303377a37f1?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evelyn Meza
4,226 Pointsagain thank you so much for your fast replies and Im so sorry for some reason i cant still figure it out, i tried this originally but it kept giving me this error code and so i thought indenting again or spaces would fix it but it shows same error but the names jump around the error code given to me
AssertionError: 'John Lennon, Paul McCartney, Ringo Starr, George Harrison' unexpectedly found in 'Ad Rock, MCA, Mike D.\nJohn Lennon, Paul McCartney, Ringo Starr, George Harrison\nSalt, Peppa, Spinderella\nRivers Cuomo, Patrick Wilson, Brian Bell, Scott Shriner\nChuck D., Flavor Flav, Professor Griff, Khari Winn, DJ Lord\nAxl Rose, Slash, Duff McKagan, Steven Adler\nRun, DMC, Jam Master Jay\nAd Rock, MCA, Mike D.\nSalt, Peppa, Spinderella\nRun, DMC, Jam Master Jay' : Uh oh, I found a non-trio!
![Evelyn Meza](https://secure.gravatar.com/avatar/336e8b5137e5ef4ebd06b303377a37f1?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evelyn Meza
4,226 Pointsfor group in musical_groups:
if len(group) == 3:
print(", ".join(group))
[MOD: added ```python formatting -cf]
![Evelyn Meza](https://secure.gravatar.com/avatar/336e8b5137e5ef4ebd06b303377a37f1?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evelyn Meza
4,226 Pointsfor group in musical_groups:
if len(group) == 3:
print(", ".join(group))
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsThe assertion error is stating it found a 4-member group in the output. Be sure the if
statement is checking for 3 members, that is, a len
of 3.
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsThe reformatted code in the first comment on this answer passes the challenge! Yay!
Harjan Anand
780 PointsHarjan Anand
780 PointsI understand that but i wanted to know how do you use that function and print out the trios only.