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

yannis sousanis
yannis sousanis
7,199 Points

I need some help here too....

What is wrong?

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

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! When doing a for in loop the word after the for is a temporary variable name for an individual item in the iterable that you're looking at. Like for singer in artistsList would go down a list of artists and every one it looks at would be named singer for the execution of that loop.

You've almost got it except that you're trying to compare the entire list of items instead of the item.

So the last part should be:

        if item[0] == "a":
            continue
        else:
            print(item)

Here we compare the first letter of the individual item. If it's "a" we continue, otherwise we print out the item.

Hope this helps! :sparkles:

yannis sousanis
yannis sousanis
7,199 Points

Thank you again for saving me