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

Nikhil Alexander
Nikhil Alexander
1,444 Points

point out my error please

.

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

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

1 Answer

Brandon Oakes
seal-mask
.a{fill-rule:evenodd;}techdegree
Brandon Oakes
Python Web Development Techdegree Student 11,501 Points

You basically got it my friend, the second part of the question wants you to print "* " + continent ONLY if continent[0] == "A". You just need to get rid of the first for loop since that has no if statement and will print all the items in the list. Code below should work for you.

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