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
Shamushideen SuleCourses Plus Student 2,509 Points
Second 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 == "a": continue print(item) else: break print(item)
def loopy(items): items = ["abc", "xyz"] for item in items: if item == "abc": continue print(item)
Henrik ChristensenPython Web Development Techdegree Student 38,322 Points
You are very close.
- you should not create a variable named items - items would be the argument.
- also, you would want to check if item == 'a' instead of checking item == 'abc'
def loopy(items): # loop through items for item in items: # if character at  == 'a' if item == 'a': # then continue continue # else print item print(item)