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

how do i write the code please help

I'd like you to now only print continents that begin with the letter "A".

HINT: Remember that you can access characters in a string by index

Important: In each task of this code challenge, the code you write should be added to the code from the previous task.

continents.py

continents = [

'Asia',

'South America',

'North America',

'Africa',

'Europe',

'Antarctica',

'Australia',

]

for continent in continents:

print("* " + continent)

​

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

for continent in continents: print("* " + continent) Your code looks right. you should check he indentation

nakalkucing
nakalkucing
12,964 Points

Hi Tinashe Steve Chipangura! Am I correct that you need help with the second part of this challenge?

2 Answers

Ok! Thanks for the heads up. i will do better.

for the second part you might want to try something like this:

for continent in continents:
    if continent[0] == 'A':
        print("* {}".format(continent))

thanks very much hey, it worked

Your welcome. Glad to help :)

nakalkucing
nakalkucing
12,964 Points

Hey Caleb Newell! I'm glad to see you want to help, that's great. :) I just want to let you know, it is usually frowned on to just give the answer to the challenge without an explanation of why and how it works.

Happy coding!