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.

Shamushideen Sule
Courses Plus Student 2,509 PointsSecond shopping list
My loopy function needs to skip an item. Loop through each item in items. 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".
My solution: def loopy(items): items = ["abc", "xyz"] for item in items: if item[0] == "a": continue print(item) else: break print(item)
def loopy(items):
items = ["abc", "xyz"]
for item in items:
if item[0] == "abc":
continue
print(item)
1 Answer

Henrik Christensen
Python Web Development Techdegree Student 38,319 PointsYou are very close.
- you should not create a variable named items - items would be the argument.
- also, you would want to check if item[0] == 'a' instead of checking item[0] == 'abc'
def loopy(items):
# loop through items
for item in items:
# if character at [0] == 'a'
if item[0] == 'a':
# then continue
continue
# else print item
print(item)