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

TJ Feledy
PLUS
TJ Feledy
Courses Plus Student 687 Points

I am unsure of what I am doing wrong in Challenge Task 1 of breaks.py.

This is the task where i need to skip the item with an 'a'. It saying that it didnt find the right items printed.

breaks.py
def loopy(items):
    # Code goes here

    for stuff in items:
        print(stuff)

        if stuff[0] == 'a':
            continue

1 Answer

Jeffrey James
Jeffrey James
2,636 Points

One way to approach it using "if not". Try to think of a way to do it without the "if not" however :)

In [5]: stuff = ['dogs', 'airplanes', 'boats']

In [6]: for x in stuff:
   ...:     if not x[0] == 'a':
   ...:         print(x)
   ...:         
dogs
boats