Olivier Jean-Francois689 Points
I'd like you to now only print continents that begin with the letter "A".
I noticed there already is an answer to the question, however i still want to know why my code is wrong. It keeps skipping over the first value in continents(Asia)?
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here for continent in continents: first_index = (continent[0:1:1]).lower() if first_index == "a": print(continent)
Rune Andreas Nielsen5,341 Points
The reason that your code is not doing is expected is because you're checking for the lowercase 'a' instead of uppercase 'A'.
The underlying value of lowercase 'a' and uppercase 'A' is different therefore your conditional statement is not executing as you might expect it to. If you want to know more about why this is happening you can read into UNICODE and ASCII characters.