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

Joel Price
Joel Price
13,711 Points

How to skip strings that start with 'a' in the quiz thing?

In the quiz I'm having a hard time. If what's entered into index 0 for items is the letter "a", I'm supposed to continue to the next one, otherwise I'm supposed to print or something. I'm pretty sure the issue I'm having is due to the way I'm trying to find the index 0 of items. But I can't find any information relating to this in this course.

Any help is appreciated!

def loopy(items):
    # Code goes here
    for thing in items:
        if items[0] = "a":
            continue
        elif thing =="STOP":
            break
        else:
            print(thing)
breaks.py
def loopy(items):
    # Code goes here
    for thing in items:
        if items[0] = "a":
            continue
        elif thing =="STOP":
            break
        else:
            print(thing)

1 Answer

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

in your loop you are calling the slice operation [0] on the list, not the items in the list, and you are using the assignment operator (=) instead of checking for equality (==). so call [0] on your loop variable and check for equality and it will work.