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

Not sure how to use indexes in this situation

I am told to print continents which start with the letter "a" and to use "for in" loop and to use indexes but I am not sure how to include indexes in the code in the situation.

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]


for continent[0,3,5,6] in continents
    print ("* " + continents)

2 Answers

for continent in continents:
     if 'A' in continent[0]:
        print ("*" + continents)

Good luck :)

You need to iterate over continent using For loop. and check if the first index of the string (continent) starts with "A".