Python Introducing Lists Using Lists Continental

Challenge question help

Can someone please tell me why this code isn't working for this challenge?
continents = [
    'South America',
    'North America',
# Your code here
for continent in continents:
    print('* ' + continent)

for continent in continents:
    if continent[0] == "A":

1 Answer

Louise St. Germain
Louise St. Germain
19,368 Points

Hi David,

You're very close! For the second part of the challenge you'll need to update the code you had for the first part of the challenge, instead of creating a second for loop. It's asking to only see only a single list containing the continents that start with "A", but the way your code is above, it lists all the continents (still), and then outputs a second list with the A-continents.

Also, in the output for the A-continents, you don't have the "* " bullet points that it's expecting.

So basically you just need to set the print statement on the last line to include the "* " (exactly like you did it for part 1 of the challenge), and then get rid of your first for loop entirely, so that it only prints out the A-continents.

Once you do that, everything should be working for part 2 of the challenge.

I hope this helps!

Wow! Silly me, thanks so much!! You saved me from buying another keyboard haha

Louise St. Germain
Louise St. Germain
19,368 Points

Haha! Glad to hear I saved you some keyboard shopping. :-D Happy programming!