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 trialIosaf Canning
1,320 PointsContinental 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 = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
print("continents:")
for items in continents:
print("* " + items)
1 Answer
Steven Parker
231,248 PointsYou 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).
Iosaf Canning
1,320 PointsIosaf Canning
1,320 PointsStill a little confused
Steven Parker
231,248 PointsSteven Parker
231,248 PointsTry creating an "if" statement between the "for" and the "print" using the hints. Show the code you have at that point.