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

What am I not understanding? Python Basics Continue Code Challenge.

I keep getting "Bummer! 'builtin_function_or_method' object is not subscriptable" and I have no idea what it is referencing in my code so i don't know where to begin tinkering. Help!

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Andrew.

Sorry, my original response was kicked out by the update to the Database servers...

There are a couple of things going on with the code.

  • First -- .index is not a valid method. To access a certain index of an array, you just need the square brackets [] with the index number enclosed.

  • Second, with you print statement, you want to print out the item, which is the temporary variable assigned to the individual values in the array. You currently have items, which is the actual (and complete) array.

So the completed code for the challenge is:

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

I hope that makes sense. If you have any other questions, feel free to post in the forum. Keep Coding! :)

Why yes! Thank you Jason. I have the index function variations written correctly in my notes. Your other fix on the print line also makes sense, although I am a little fuzzy on using singular and plural words as variables. Thank you for your help.