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

Maggie Wolff
Maggie Wolff
495 Points

python basics challenge task 1 of 1 "Continue"

I know I'm probably not using 'index' correctly, but someone please help.

breaks.py
def loopy(items):
    # Code goes here
    "dog, ant, cat, bird"
    for item in items:
        if index 0 == 'a':
            continue
        print(item)

2 Answers

Thomas McDonnell
Thomas McDonnell
8,212 Points

Hi Maggie, Why do you have a string "dog, ant, cat, bird" in your function?

but yes your right if you want to point to a particular index you need to use the brackets [] so it would look like this:

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

but I think you also need an else statement for print(item)

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

Maggie Wolff
Maggie Wolff
495 Points

THANK YOU SO MUCH!