Python Introducing Lists Using Lists Continental

Md Akibe Hashan
Md Akibe Hashan
1,503 Points

I'd like you to now only print continents that begin with the letter "A".

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

Your code here

for a in continents: print("*",a)

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for a in continents:
    if a[index at 0]=="A":
        print(a)

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,939 Points

To specify an index you just need the value a[0]. In task 2 you will also need to print a bulleted list.

Mattia Lanzi
Mattia Lanzi
471 Points

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