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

What's going on with my code?

i am on task 1/1 and i keep getting errors for stuff i have done

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

okay so now it says i have two problems in my code. i changed my code to: print("continents:") for continents in continent: print("* " + continents)

1 Answer

Steven Parker
Steven Parker
231,198 Points

You didn't say what errors you are getting, but at first glance I noticed this:

for continents in continents:

You can't use the same variable name for both the loop variable and the iterable.

what should i put as the iterable then?

Steven Parker
Steven Parker
231,198 Points

The iterable is correct, you just need to pick a different name for the loop variable (any name of your choice).

ok I'll try that and let you know how it goes

Steven Parker
Steven Parker
231,198 Points

The iterable is the one that comes last, and it was correct before when it referenced the list. It's the loop variable (the first one) that needs a different name.