Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Continue

i need help

i cant figure out what im doing wrong

def loopy(items):
    # Code goes here
    for item in items:
        if item == "a":

2 Answers

Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

I'm not experienced enough with Python at this point but I'd still like to attempt to help. Are you saying you're having trouble with Python's indentation rules? I just want to make sure that's really what you're after.

Steven Parker
Steven Parker
216,012 Points

:point_right: Check your indentation

An else should always line up with the corresponding if.

Also, you don't want to compare the entire item with "a", just the first character (at index 0).

Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

Yes, Python's strict indentation rules take some getting used to by I kind of like them. I figure once I have the drill down on that, I won't have to think about it.

i tried using len that didnt help