Python Introducing Lists Using Lists Continental

Friedrich Dalman
Friedrich Dalman
1,502 Points

How do you access the first letter in the word?

How do you access the first letter in the word so that you can use an if statement to print the correct list of continents out?

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

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

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
53,479 Points

You are really close. You are just missing a colon here:

if continent[0] == "A":