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

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,885 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 :)!!