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 trialShavez Memon
Python Development Techdegree Student 2,452 PointsTask2: What am I doing wrong?
Could you please tell me what I am doing wrong for Task 2? I seem to get an error. Thank you!
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 members in musical_groups:
print(", ".join(members))
for members in musical_groups:
if len(members) == 3:
print(", ".join(members))
3 Answers
nakalkucing
12,964 PointsHi Shavez Memon! The instructions ask you to:
only print out the trios? It should still use the joined string format from task 1.
You still have all the members being printed out from the first task. They want you to change the for loop from the first task to only print the trios. Hope this helps. Happy coding! :)
Shavez Memon
Python Development Techdegree Student 2,452 PointsYa I believe that's what I tried to do for the 2nd task and get this error: Uh oh, I found a non-trio!
My code for task 2 is:
for members in musical_groups:
if len(members) == 3:
print(members)
nakalkucing
12,964 PointsHello again, Shavez Memon! Sorry it took so long to get back to you.
Is that all of your code for task 2? Because you still need the for loop too:
for members in musical_groups:
Hope this helps! :)
Shavez Memon
Python Development Techdegree Student 2,452 PointsHello, thanks for responding.
No sir, my code (as shown above) is:
for members in musical_groups:
if len(members) == 3:
print(members)
nakalkucing
12,964 PointsOops! Sorry, Shavez Memon, my bad. I missed that.
I should have caught this before: ", ".join(members) (Currently you just have print(members) )
Thanks for being patient with me. Let me know the result. :)