Python Introducing Lists Using Lists Continental

Holly Bancroft
Holly Bancroft
3,545 Points

How did you solve the question "I'd like you to now only print continents that begin with the letter "A"."?

I am trying to figure out how to only list the continents that begin with "A". Could someone show me how they solved this?
continents = [
    'South America',
    'North America',

for continent in continents:
    print("* " + continent)

1 Answer

54,333 Points

There is a hint: Remember that you can access characters in a string by index. For your code you would use continent[0] to access the first character of continent (the index starts at 0).

Then use an if statement and compare this to "A" and if they match print your bulleted list item.