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 trial

Python Introducing Lists Using Lists Continental

Challenge question help

Can someone please tell me why this code isn't working for this challenge?

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for continent in continents:
    print('* ' + continent)

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

1 Answer

Louise St. Germain
Louise St. Germain
19,424 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,424 Points

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