Welcome to the Treehouse Community
Looking to learn something new?
Print continents starting with A
I don't understand why this isn't working. For each item in the list continents, if the 0th character is A, print the item.
Edit: the index needs to be in square brackets for some reason, but I don't understand why this works. It's not a list.
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here for item in continents: if item(0) == "A": print("* " + item)
You sort of answered the question already: "the index needs to be in square brackets".
At the moment you are using parenthesis instead of square brackets, hence the error.
Keenan SmithPython Development Techdegree Student 5,487 Points
I was confused on this one too. I didn't think to use an if statement in the for-in loop. 😫