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

hana haytham
hana haytham
2,232 Points

i am having trouble understanding iteration !!

i cant understand what i did wrong in the code or honestly how to work with the for in loop

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

1 Answer

Phil Livermore
Phil Livermore
11,018 Points

The for loop is ok, the error is in the print statement. Remove the quotation marks around continents and also remote the 's' to make it continent. Continents is the list which is iterable, this means you can use it in a loop among other things. Continent (Without the 's') is one of the continents in the list so you want to print them one at a time. The loop will go through each item in the list and print them one at a time.