Python Introducing Lists Using Lists Continental

Chris Bogues
Chris Bogues
Python Web Development Techdegree Student 537 Points

How can I print only the letter A

Hello - I'm a little confused on how I can select certain continents. If I do 'continents[0] ', I get the first letter. How can I select the ones with the letter A?
continents = [
    'South America',
    'North America',
# Your code here
for continent in continents:
    print("* " + continent[0])

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 58,943 Points

What if you use continent[0] as an if statement condition, then print whole name?

Post back if you need more help. Good luck!!!

Edin Gunic
Edin Gunic
1,564 Points

I struggled with this one a bit but reading Chris's answer was a lot of help. Here is what worked for me:

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

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