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.

breaks.py Exercise: Skipping the List item in for loop

I am trying to put below code for breaks.py exercise and in console it's working fine but the exercise is not accepting the answer.

def loopy(items): # Code goes here for no in items: if no == 'a': continue else: print(no) loopy(items)

breaks.py
```def loopy(items):
# Code goes here
for no in items:
if no == 'a':
continue
else:
print(no)
loopy(items)
```

Hi Vipin

there is a error in your code at line 4. You need to check if the items index 0 is 'a', you were checking against every item rather than the index 0 of each item. so if you had a list like so ['a','n','d','r','e','w'], the code would print everything apart from index 0 which is the letter 'a'.

see below

```def loopy(items):
# Code goes here
for no in items:
if no[0] == 'a':  # This is the line that caused the error. Your code was checking against every value rather than index 0
continue
else:
print(no)
```

hope this helps

Hi Andreas, Thanks for the response. As you said I interpreted this question the same way first time and wrote the code as below. But even this won't work.

def loopy(items): # Code goes here if items[0] == 'a': items.remove('a') for no in items: print(no)

Hi Andreas, Thanks for the response. As you said I interpreted this question the same way first time and wrote the code as below. But even this won't work.

'''def loopy(items): # Code goes here if items[0] == 'a': items.remove('a') for no in items: print(no)'''