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

Need help in Challenge for Shopping list 2 section

I need help with this question. Not sure how to identify index 0 character of a work. Please advise.

"Same idea as the last one. My loopy function needs to skip an item this time, though. Loop through each item in items again. If the character at index 0 of the current item is the letter "a", continue to the next one. Otherwise, print out the current member. Example: ["abc", "xyz"] will just print "xyz"."

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

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
        print(item)
        except item == "a"

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

Given a string in variable item you can check if the first character is an "a" using the comparison

if item[0] == "a":

Post back if you need more help. Good luck!!!

Thanks a lot