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 trialEd Basquill
3,984 PointsStuck and can’t see my syntax error For group in musical_groups Print(“, “.join(group))
Last challenge in python lists
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(group)
2 Answers
Steven Parker
231,269 PointsKaisma's solution is interesting, but you don't need to add the group number to pass the challenge. In fact, for most challenges it's not a good idea to do anything the instructions don't ask for, because it can confuse the validation.
Anyway, your syntax error was just leaving off the colon (:) at the end of the "for" line. But even after fixing that, you'll still need more code to handle the instruction that asks you to "output the members joined together with a ", " comma space as a separator". The word "joined" is a clue there, and the "join" function is perfect for doing this job.
Kaisma Penn-Titley
PHP Development Techdegree Graduate 20,208 PointsHi Steven, thank you for your comment. I'm aware that the additional formatting is not needed. However, it made the output more sensible and was able to pass the validation without any challenges.
Steven Parker
231,269 PointsThis particular challenge allows it. But be aware that doing extra things can cause false "fail" results on many of the other challenges. Happy coding!
Kaisma Penn-Titley
PHP Development Techdegree Graduate 20,208 PointsKaisma Penn-Titley
PHP Development Techdegree Graduate 20,208 PointsHey Ed, I spent some time on this challenge too and ended up placing my code in an online python REPL testing multiple solutions. Ultimately, the following worked for me and passed the quiz:
For the print statement, I added text before the join statement to print out which group I was on.