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

Chase Alfrey
Chase Alfrey
996 Points

Python Basics: Continue Problem

I can't seem to figure out what is wrong with the code shown below. I know it probably has something to do with line 3, but I don't know what to change in that line to fix it.

breaks.py
def loopy(items):
    for item in items:
        if item.index("a") == 0:
            continue
        else:
            print(items)

1 Answer

There are two problems that I can see in your code. In your If statement you need to searching index 0 of the string the same way you would an array. In your print command you are telling it to print the whole array instead of just that index (need to change items to item)

def loopy(items):
    for item in items:
        if item[0] == "a":
            continue
        else:
            print(item)