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

Elisa Burghard
Elisa Burghard
9,276 Points

Continent starting with A - Challenge It displays as asked but still gives me an error message.

I found a solution in the community and applied it. It displays well in the preview window, but still gives me an error message. UPDATE: After a few reloads of the page it finally accepted the answer. Does anyone know why this happens? It's a bit frustrating when you think you have the right answer and it still shows the error message, so you keep looking for other answers...

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

print("All Continents:")
for all_continents in continents:
    print("* " + all_continents)

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

2 Answers

Steven Parker
Steven Parker
231,198 Points

The instructions said "to now only print continents that begin with the letter A". But this code is printing the entire list and then the "A"s.

Remove the first loop and you'll pass.

Elisa Burghard
Elisa Burghard
9,276 Points

Actually it always says: Important: In each task of this code challenge, the code you write should be added to the code from the previous task. And it did pass with all the code after reloading and copy pasting it all. ThatΒ΄s why I wondered if that is just a bug... Thank you for taking the time to answer :)

Steven Parker
Steven Parker
231,198 Points

That "added to the code" message is standard. Sometimes, like here, the "added" part means adding to an existing function instead of creating another complete one. What gets added here is the conditional statement.

If you leave both versions there for task 2, you'll get "Bummer: Whoops! I found a country that didn't start with A in your output".

I suppose the requirements could have been a bit more explicit and the validation results should be consistent. If you'd like to submit a bug report for either, you'll find instructions on the Support page.

Elisa Burghard
Elisa Burghard
9,276 Points

Thank you, Steven! I did get that message finding continents not starting with A. I finally did get through even with the part 1 still in there, so that was weird. Maybe I should send a bug report. Thanks again and I hope you have a nice week-end.