Hey can someone please explain to me why this does not work and how it would work?
I tried this code
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here for i in continents: if continents = continents[i] = "A": print("* " + i)
KRIS NIKOLAISEN52,654 Points
Not sure what you have there:
- You are using assignment operators in an if statement that don't make sense
- i in your for in loop is a string but you try to use it as an index in
- You need to indent your print statement to be the code executed by your if statement
This would work
for i in continents: if i == "A": print("* " + i)
In the code above i is each continent name and i is the first character in the name. The comparison operator == is used to compare the character to "A" and if true print the bulleted name.