Python Introducing Lists Using Lists Continental


how to access continents starting with leeter A
continents = [
    'South America',
    'North America',
# Your code here
for continent in continents:
    print(" * " + continent)

1 Answer

Steven Parker
Steven Parker
179,704 Points

You can access individual characters in a string by indexing, using brackets similar to working with a list. Since index numbers start at 0, the first character of "mystring" would be "mystring[0]".

You could then compare that to the letter "A" in a conditional expression.