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

Christian Abreu
Christian Abreu
3,587 Points

AssertionError: 7 != 9 : Please don't alter the continents list

Hello! I'm not quite sure what is causing this error to occur? Output states the error is on line 40.

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

1 Answer

Steven Parker
Steven Parker
231,271 Points

Using the same variable for both the source and the loop control causes the original list to be changed by the loop.

Try using a different variable for the loop control. A popular choice is the singular version of the list name.