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

Continental Can i get the answer for this

Can I get the answer for this how do i sort it for the ones that start with A's

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

1 Answer

Steven Parker
Steven Parker
231,269 Points

You can add an "if" statement to control when the "print" will run, and it can test the first character of the "items" to see if it is "A".

You can isolate a specific character of a string by indexing (a number in brackets after the variable name).

Still a little confused

Steven Parker
Steven Parker
231,269 Points

Try creating an "if" statement between the "for" and the "print" using the hints. Show the code you have at that point.