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 trialseanwoleslagle
2,839 PointsNeed help with 2nd part of groups.py
I got the first part of my code right. I can't figure out where I'm messing up for the second part of the challenge, and why I'm messing it up.
This is what I got right for the first part:
'''for group in musical_groups: group_members = ", ".join(group) print(group_members)'''
However, if you see my code, you'll see how I'm messing up somewhere. I really appreciate any help on this matter!
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:
if group = 3:
group_members = ", ".join(group)
print(group_members)
1 Answer
Steven Parker
231,248 PointsSince the group is a list, it would never equal a number. But you could compare the length of a list to a number.
Also be careful about operator symbols. A single equal sign ("=") is an assignment operator. A comparison operator is a double equal sign ("==").
seanwoleslagle
2,839 Pointsseanwoleslagle
2,839 PointsLol, I just posted about this too. Still figuring the '=' vs '==' thing out I suppose. That was a silly mistake on my part. I ended up figuring it out. Thanks for your help!
Steven Parker
231,248 PointsSteven Parker
231,248 PointsWhen posting code, those three marks are accents (not apostrophes). Also, posting the final solution to a challenge is generally discouraged by Treehouse.
seanwoleslagle
2,839 Pointsseanwoleslagle
2,839 PointsSorry about that. I'm still a newbie to how things work. I will keep that in mind for the future. I deleted my code from my previous post so it isn't out there for somebody to copy and paste. I appreciate the help.