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

Python Introducing Lists Build an Application Multidimensional Musical Groups

Need 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!

groups.py
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
Steven Parker
231,248 Points

Since 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 ("==").

Lol, 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
Steven Parker
231,248 Points

When posting code, those three marks are accents (not apostrophes). Also, posting the final solution to a challenge is generally discouraged by Treehouse.

Sorry 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.