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

i have no idea how to do this one

i just dont know how to get through this challenge

breaks.py
def loopy(items):
    for i in items:
        print()i
        if i == i.index(0):
            continue
        else:
            print(i)

1 Answer

Hi Jessica!

You have two errors in your code.

First of all you want to delete the print statement after you declare the for loop.

Then, you need to change your if statement. First of all, the i.index() method is used to get the index of an item of a list. For example:

for i in items:
    if i == i.index(0): #This line is basically saying: if the item in the list is is equal to the part of the item's index. It is looking 
                                # for a part of the item that that is 0. Not the index 0. To look for the index 0, you do it like this: i[0]
        continue
    else:
        print(i)

Finally you need to delete the" i == "part of the if statement and ask if that is "a". Like so:

def loopy(items):
    for i in items:
        if i[0] == "a": # it should look like this now
            continue
        else:
            print(i)

The end result of the code should look like this:

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

I hope this worked for you!

If this does not, please let me know.

Thanks!