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 trialCarter Ellis
1,323 PointsHaving trouble with groups.py, anyone know what to do from here?
I think I might be forgetting something in the if statement, but I'm not sure
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"],
]
group_number = 1
if len(musical_groups) = (3)
for groups in musical_groups:
print("Group: #{}".format(group_number), ", ".join(groups))
group_number += 1
Carter Ellis
1,323 PointsThanks nakalkucing! I got it!
nakalkucing
12,964 PointsGreat!
1 Answer
Steven Parker
231,269 PointsYou're pretty close, all the parts are there, you just need a little re-arranging and some syntax fixups:
- try doing the length test inside the loop (after the "for" line)
- also test the individual loop item (groups) instead of the entire list (musical_groups)
- the comparison operator for equality is "==" (a single "=" is for assignment)
- an "if" statement should have a colon at the end of the line
Give it another shot with that in mind, and write again if you still have trouble.
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsHi Carter Ellis! Have you looked at the Preview Pane? The first problem it indicates is that you have invalid syntax here on line 12:
Hint: you're attempting to assign len(musical_groups) to (3) right now. Which is impossible.
Let me know if you need more help. :)