Python Introducing Lists Using Lists Continental

Pridemore Viriri
Pridemore Viriri
5,512 Points

Python List

How can i edit the code to print only continents that starts with letter "A" using index

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

3 Answers

Pridemore Viriri
Pridemore Viriri
5,512 Points

i try this below but im getting errors

for continent in continents: print("",continent) if continent .index("A")==0: print("",continent)

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 47,377 Points

To access the first character of continent with an index use: continent[0]. Also note task 2 wants a bulleted list.