Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Introducing Lists Build an Application Multidimensional Musical Groups

Aleksandra Laska
Aleksandra Laska
5,343 Points

What should be added to this code ?

Can you please help me with this exercise ?

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 x in musical_groups:
    y = musical_groups.join()[1]
    print(musical_groups)

1 Answer

Daniel Turato
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Daniel Turato
Java Web Development Techdegree Graduate 30,124 Points

First 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))