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

Cong Nguyen
Cong Nguyen
2,346 Points

stuck on the part 02 of this question, the video only went through a similar problem to part 01 but not part 02.

don't know where to start

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

for continent in continents 
    print(continent)

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,722 Points

You need to make sure to put a colon at the end of the for loop, and then you need to use conditional branching inside the for loop. Example below.

for example, if I wanted only continents that have the FIRST letter in the string 'B':

for continent in continents:
    if continent[0]=='B':
        print("* " + continent)