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

Charles Russell
Charles Russell
7,169 Points

I'm experiencing difficulty understanding why this error is showing up. It passes in the output window.

Any insights would be appreciated. The code works as expected in both my IDE and the output window of the challenge. It appears to run properly, with the exception of an assertion error: "Bummer: AssertionError: 7 != 9 : Please don't alter the continents list". I'm still fairly new to this, however I don't see any commands to alter the list. TH issue?

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

Your code here

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

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
print("Continents:")
for continents in continents:
    print("* " + continents)
Charles Russell
Charles Russell
7,169 Points
Ran 1 test in 0.000s

OK
F.
======================================================================
FAIL: test_code_untouched (__main__.TestIterationExecution)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "", line 40, in test_code_untouched
AssertionError: 7 != 9 : Please don't alter the continents list

1 Answer

You'll want to iterate with continent singular

print("Continents:")
for continent in continents:
    print("* " + continent)

Is it necessary to remove the "s" plural?

I am getting the same results with the "s" plural when I run the cod through Pycharm.

And also, "continent" is not defined in the program so how come this does not produce a NameError?