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'm not sure why this is not working.

The question asks to skip if it is 'a' at index 0 and then continue to the rest. I'm not sure why the error prompt is telling me to try again. Am I missing something from my else statement?

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
      if item{0} == 'a':
        continue
      else:
        print(item)

2 Answers

You dont need a else since there is a continue in the if part of your if-statement. Also the brackets for the index look weird (atleast in other languages we use [] for the index as I know)

def loopy(items):
    for item in items:
        if item[0] == "a":
            continue
              #this print will not get executed when the if-statment is true since 
             # there is a continue which will executed the loop again
        print(item)
Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey there Patricia,

You are pretty much there, except for one tiny error: You have mixed up which kind of bracket you need to use. When wanting to pull a specific index, you need square brackets (not the curly braces). So if you just change those, you will be all good to go. :)

if item[0] == 'a':

Keep Coding! :dizzy: