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

Jeff Ness
seal-mask
.a{fill-rule:evenodd;}techdegree
Jeff Ness
Front End Web Development Techdegree Student 8,921 Points

I'm at a loss. I thought I set up a condition that would skip printing an index item and index "0" if it were an "a"?

I don't know what to do from here.

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

3 Answers

andren
andren
28,558 Points

Your code is correct, you just have a typo in it. You use the word "items" in your if statement rather than "item" which is the thing you are actually supposed to be checking the index of.

If you change "items" to "item" like this:

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

Then your code will pass.

Hey Andren, I didn't see that you already answered this. At least we agree :D

andren
andren
28,558 Points

john larson: No worries, I've ended up in the same situation myself numerous times. And it's indeed good that we agree, if we didn't one of our answers would be incorrect which is never fun :smile:.

# I tried the same thing as you
# item in this case is "abc" so it must me item[0]
# not items[0]
# items would be the whole list
def loopy(items):
    # Code goes here
    for item in items:
        if item[0] == "a": # <--- here
            continue
        else:
            print(item)