Python Python Basics (2015) Shopping List App Continue

SOS

what's the wrong code i have typed in that's preventing my code to run perfectly? plz tell

breaks.py
def loopy(items):
    for item in items:
        if items[0] = "a"
        continue
        else:
            print(items)
    # Code goes here

1 Answer

Hello,

def loopy(items):
    for item in items:
        if items[0] = "a"  #<-- Is the condition you should not use equal operators "!=" and don't forget ':' at the end, item without "s", items are already definite
        continue
        else:  #<-- you do not use else here
            print(items)  #<-- return item without 's' and print before continue

#<-- In summary
def loopy(items):
    for item in items:
        if item[0] != 'a':  
            print(item)
        continue  

Happy coding