Python Python Basics (2015) Shopping List App Continue

TJ Feledy
PRO
TJ Feledy
Pro 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,635 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