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

Michael Dinnall
Michael Dinnall
6,730 Points

Need help, got stuck for a while now. maybe i don't get the logic compltely

def loopy(items): for item in items: if item[0] == "a": print item

print loopy(items)

def loopy(items):
    for item in items:
     if item[0] == "a":
        print items

1 Answer

Hey Michael! The task is asking you to NOT print if the first char of item is 'a'. So, when the first char == 'a'. Skip it(continue). Else, print it. Here is how I solved it:

for item in items:
    if item[0] == 'a':


You could also simply do an if item[0] != 'a': to skip it, but your approach might be more "Pythonic".. I couldn't say.