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!

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

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
227,141 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