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

I can't figure out the answer

I can't figure out the answer to this. I tried doing it the same way the professor did but it didn't work. Can anyone figure out the answer so that I know what I did wrong.

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

print("Continents:")
for continents in continents:
    print(continents(0) + continents(1))

1 Answer

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 37,776 Points

First your variable in the for loop needs to be a different name than the collection. I would use continent. And you don't need (0) and (1). The value of continent will be the collection element each time through. So something like this for the for loop.

for continent in continents:
    print(continent)

You will just need to add the bullet point