Python Introducing Lists Using Lists Continental

Tichaona KUNDODYIWA
Tichaona KUNDODYIWA
5,031 Points

i have tried many times but could not get it right

where am i getting wrong please help

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

for continent in continents :  
    if continent.startswith("A"):
           print("* " + continent )

2 Answers

Hardeep Asrani
Hardeep Asrani
11,319 Points

You just have to check the continent string by its index

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for continent in continents :
    if continent[0] == 'A':
        print("* " + continent)
Myers Carpenter
STAFF
Myers Carpenter
Treehouse Staff

Your code is fine, you just need to remove the loop that printed all the continents.