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 trial

Python Python Basics (2015) Shopping List App Continue

Breaks.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!

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
      if item[0].index == 'a':
        continue
      print(item)

2 Answers

Nicholas Grenwalt
Nicholas Grenwalt
46,626 Points

You pretty much have it handled. Just erase the ".index" and you're good to go Jacob.

Nicholas Grenwalt
Nicholas Grenwalt
46,626 Points

How 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.

Thank you so much!!

def loopy(items): # Code goes here for item in items: if item[0] == 'a': continue print(item)