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 trialJacob Armstrong
4,352 PointsBreaks.py Cannot check for 'a' in a certain index and skip that item
I need help with the indexing part of the task, the continue part I am fine with. Please help in any way possible!
def loopy(items):
# Code goes here
for item in items:
if item[0].index == 'a':
continue
print(item)
2 Answers
Nicholas Grenwalt
46,626 PointsYou pretty much have it handled. Just erase the ".index" and you're good to go Jacob.
Michael Rasay
2,860 Pointsdef loopy(items): # Code goes here for item in items: if item[0] == 'a': continue print(item)
Nicholas Grenwalt
46,626 PointsNicholas Grenwalt
46,626 PointsHow the index works is for each 'item' that gets passed from the 'items' array attaching [number] (i.e. item[0] will access the first character, item[3] will access the fourth)will access whatever position you want starting at 0. Any item that gets that has 'a' as the first letter won't be printed all others will. Hope that helps.
Jacob Armstrong
4,352 PointsJacob Armstrong
4,352 PointsThank you so much!!