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

Dyllan Higgins
Dyllan Higgins
850 Points

Bummer: AssertionError: 7 != 9 : Please don't alter the continents list Looping through array

Could someone please point out the error I am making? Can't seem to find it myself. :(

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

2 Answers

John Lack-Wilson
John Lack-Wilson
8,181 Points

It's because in your foreach loop you have an s at the end of the first continents variable. With Python foreach loops the first variable should be named differently to the second variable, as it is assigning an element from the array to a new variable.

You want to print the singular continent, not the whole list.