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

Göktuğ Özdem
Göktuğ Özdem
441 Points

I need help about the question :)

-

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

2 Answers

Ari Misha
Ari Misha
19,323 Points

Hiya Goktug! I'd say your logic is on the point but i think you need to refactor a code little with these couple of point:

  • first off, it should be "==" not "=" , im guessing its a typo right? -second off, you cant say 'x.index(0)' coz it'd raise an AttributeError saying 'int' object has no attribute 'index'. Perhaps, you might wanna try if x[0]=='a': . Everything else seems alright to me (:
Göktuğ Özdem
Göktuğ Özdem
441 Points

Hey Ari, I often get error about the syntax and I think it is because I am new to python :) Probably I will need help about other questions :D Thanks for your time !