Python Introducing Lists Build an Application Multidimensional Musical Groups

Rigby Adams
Rigby Adams
1,144 Points

BRUH! im so confused

AHHH help
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"],
for band in musical_groups:
    print('{}, '.format(musical_groups)
Jeremy Charles
Jeremy Charles
Pro Student 643 Points


Don't forget the closing parentheses for your print statement. *

The "for" keyword can be thought of as "for each". You can think of the first line of a for loop as: for each x in thing:.... On each loop the x becomes the sub item of the main item that is being looped over. Example:

for x in "apple": print("x now equals: ", x)

Output: x now equals: a x now equals: p x now equals: p x now equals: l x now equals: e

Therefore you'll want to be working with the sub lists in the musical_groups list, which you have already called: band, in the first line of your for loop. Then you'll just need to: ", ".join(band)

1 Answer

Michael Cronk
Michael Cronk
5,550 Points

Basically, instead of doing the '.format()' use '.join()' and get rid of the {} brackets. Also don't use the list 'musical groups' you have to use the 'band' var created in the for loop.

for band in musical_groups:
    print(', '.join(band))