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

Is this challenge broken? I don't understand why it's printing out extra information.

I am doing the introducing list python challenge task 2 of 2. In my code below I have tried several different ways of solving this challenge (they are all there for example purposes). With a loop which for some reason prints of Europe, with an if statement that states A continent that does not start with A was found. And then I called the index and the same issue. Am I doing something wrong.

Any ideas on this issue? I thank any and everyone in advance.

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for continent in continents:
    print(" * " + continent)

for A in continents: 
    print(continents)

print(len(continents))

print(continents[0])
print(continents[3])
print(continents[5])
print(continents[6])

if continents == "A": 
    print(continents)

3 Answers

There should only be one print statement. Also make sure there is no space between continent and [0].

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

Robert Gulley Thanks so much, I cannot believe I didn't catch that lol. It passed now.

Hi Randolph! -

Remember that you can access characters in a string by it's index. Since we want to know the first character, we would reference the 0 index. Therefore, inside the for loop, we would have an if statement that checks the first index, and if it equals "A", we print the result, like below:

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

This is all the code that you need to complete the challenge.

Hope this helps!

Hello Robert Gulley thanks for answering. I should have added that I did that as well. I still get the error that it looks like an continent that does not start with A was included.

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

Your code here

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

Apologies in advance for the poor clarity in grammar.