Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Katrine AMS Guirguis
2,587 PointsLists/Continents Python challenge: I need help with task 2
I’m confused about the code for task two....
continents = [
'*Asia',
'*South America',
'*North America',
'*Africa',
'*Europe',
'*Antarctica',
'*Australia',
]
print("continents:")
for continent in continents:
print("*" + continent)
3 Answers

Chris Freeman
Treehouse Moderator 68,239 PointsHey Katrine Guirguis, After Task 1, the for-loop and the print statement output every continent in continents
. For Task 2, the challenges is to only print the continents that begin with an A.
One strategy is to use a put the print statement in a code block under a conditional statement, such as an if
statement. The condition would be to verify the first character of the continent name begins with an "A".
As a refresher, you can access the first character of a string continent
using an index, as in, continent[0]
or the method continent.startswith()
where the argument is the string you hope to match, as in, startswith(“A”)
Post back if you need more hints. Good luck!!

Katrine AMS Guirguis
2,587 PointsThat’s what I thought of, but I kinda need help with the if statement... Also, would we have to use the index string as the challenge says? Thanks!

Chris Freeman
Treehouse Moderator 68,239 PointsI’ve expanded my answer above to show more explicit examples on how to access the first character of the variable string continent
using an index and with the existing method startswith()

Katrine AMS Guirguis
2,587 PointsThank you!!
Chris Freeman
Treehouse Moderator 68,239 PointsChris Freeman
Treehouse Moderator 68,239 PointsSorry, there are two other errors in the code.
continents
list. These need removalLuis Rivas
Courses Plus Student 21,713 PointsLuis Rivas
Courses Plus Student 21,713 PointsThank you, Chris!