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

Dillon Shaw
Dillon Shaw
6,400 Points

I'm sort of confused by what this is asking: "If the current item's index 0 is "a", continue to the next item."

When I try out my code in the workspace with an example list it does what I think it is asking: prints every item, unless that item is "a". But the Challenge is telling me that this is wrong.

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

2 Answers

It needs to have an if statement that checks the index of zero in your current item in your loop, like this:

def loopy(items):
    # Code goes here
    for item in items:
        if item[0] == 'a':
            continue
        else:
            print(item)
Dillon Shaw
Dillon Shaw
6,400 Points

Ah, didn't see it was asking for the first letter of an item. Thanks.