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

Suleiman Abdurozikov
Suleiman Abdurozikov
2,943 Points

I need a help

heeelp

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

2 Answers

Try this:

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

Good luck! ~alex

Jacob Herrington
Jacob Herrington
15,835 Points

You are very close, however you've got an extra loop in there.

The "while" loop is unnecessary, you've got a "for ... in" loop to do the work here.

So if you remove the while loop, then think about your If/Else statement. We need the loop to skip something IF a certain value is one of the elements it finds, ELSE we need to print the value of the element we are on. Try it on your own without looking at my code, but if you can't, here is passing code. Try to figure out why this code passes and yours doesn't:


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