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 trialmarkcicero
3,172 PointsNot sure how to use indexes in this situation
I am told to print continents which start with the letter "a" and to use "for in" loop and to use indexes but I am not sure how to include indexes in the code in the situation.
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
for continent[0,3,5,6] in continents
print ("* " + continents)
2 Answers
jhon white
20,006 Pointsfor continent in continents:
if 'A' in continent[0]:
print ("*" + continents)
Good luck :)
Jassim Alhatem
20,883 PointsYou need to iterate over continent using For loop. and check if the first index of the string (continent) starts with "A".