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 trialAndrew Matimba
10,255 Pointscontinents.py
How do i use index() to print continents with "A" only
continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia']
# Your code here
for continent in continents:
if continent.index(0) == "A":
print("* " + continent)
1 Answer
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsYou use index like this
continent[insert index here]
# example
name = 'Bob'
name[2] # == b
Andrew Matimba
10,255 PointsAndrew Matimba
10,255 PointsThanks my brother that was helpful