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 trialAleksandra Laska
5,343 PointsWhat should be added to this code ?
Can you please help me with this exercise ?
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 x in musical_groups:
y = musical_groups.join()[1]
print(musical_groups)
1 Answer
Daniel Turato
Java Web Development Techdegree Graduate 30,124 PointsFirst of, you're using the join method wrong. To use the join method, you're meant to specify a separator string (a string which will separate each element in a list) first then call the join method on that string passing in the the given list. You can read more about join here - https://appdividend.com/2019/01/31/python-string-join-example-python-join-method-tutorial/. Secondly, I'd recommend naming your for loops iterator values something with meaning as x & y is hard to distinguish the meaning they have. With that being said, this is what I got:
for group in musical_groups:
print(", ".join(group))
Aleksandra Laska
5,343 PointsAleksandra Laska
5,343 PointsTHANK YOU !