Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Introducing Lists Using Lists Continental

i dont understand this

why this works?

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

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

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

and this does not:

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

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

for a in continents: if a[0] == "A".lower():
print(a)

i am referring to the second FOR LOOP, .lower does not seem to take effect, probably i am missing something, HELP

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

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


for a in continents:
      if a[0] == "a".lower():
            print(a)

1 Answer

Steven Parker
Steven Parker
231,275 Points

In the second one, you're trying to match with "A".lower(), which is the same thing as "a" (lower-case "a"). And none of the names start with "a" (but several start with "A").

i need a break, that was TOO OBVIOUS. i just changed it to .upper, THANKS!!!!! .

Steven Parker
Steven Parker
231,275 Points

You don't need "upper", since "A" is already upper case.