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

Ewa Top贸r
Ewa Top贸r
3,351 Points

print continents that begin with the letter "A". please! help I have no idea what to do :(

I spent 3 hours with this and I don't have idea

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
print("continents:")
for continent in continents:
    print ("* " + continent)
Ewa Top贸r
Ewa Top贸r
3,351 Points

I wrote this: for continent in continents: if continent [0] == "A": print (continent)

'Asia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

I see you learned how to loop through a list and write conditional statements. That's a great start-- let's build on that.

By the way-- you pretty much solved the problem. The one thing to watch out for is the Challenge automatic grader only marks your solution as correct if it gets an EXACT match. So extra print statements should be removed from your code.

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# your code goes here.
# print("continents:") # commented this out, since it isn't needed.
for continent in continents:
    # let's put in your conditional statement here
    if continent[0] == 'A':
        print ("* " + continent)