Python Introducing Lists Using Lists Continental

Vladimir Lapcevic
Vladimir Lapcevic
6,215 Points

Could someone please explain why my code is not working? Thanks

why is my second task wrong? thanks

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


    print("* " + continents[0])
    print("* " + continents[3])
    print("* " + continents[5])
    print("* " + continents[6])

1 Answer

bot .net
bot .net
10,084 Points

Hi, the working code is this:

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code herv 

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

first u do a for loop an iterating each element in the array, then u need to check if the first letter which is in index zero starts with a, if it is u print.

if this helps u mark as best answer