Python Python Basics (2015) Shopping List App Continue

Lalit Aditya
Lalit Aditya
400 Points

If the character at index 0 of the current item is the letter "a", continue to the next one.

What is wrong in my code?

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

2 Answers

Antonio De Rose
Antonio De Rose
20,230 Points

please work on with the indentation, your logic is correct, the way, you have tackled, the question is correct, but, you gotta work on to your indentations, if you are to continue as a python developer, cause, python is not forgiving on it's indentation, unlike other languages, loops and if's, and the statements are differentiated and understood by the python engine, on the basis of indentation.

def loopy(items):
    # Code goes here
    for item in items:
        if item[0]=="a":
            continue
        else:
            print(item)
Lalit Aditya
Lalit Aditya
400 Points

Antonio De thanks for the code and your suggestion. I will definitely work on indentation!! I was breaking my head to find out the mistake :)!!