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

Ted Hayali
Ted Hayali
5,403 Points

continue problem

def loopy(items): # Code goes here for item in items: if items[0] == "a": if item == 0: continue else: print(items[item])

loopy(items)

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
        if items[0] == "a" && item == 0
         continue
        else:
            print(items[item])

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Ted! You've got a couple of problems here. First, you're missing a colon to denote the beginning of a code block. Secondly, your indentation is a little off. Third, we want to evaluate the first letter of item, not items. Let's say for example that the items being sent in looked like this ['apple', 'lemon', 'kiwi', 'orange']. We want to print out every item that doesn't start with "a".

def loopy(items):
    # Code goes here
    for item in items:
        if item[0] == "a":
            continue
        else:
            print(item)

Here, we're accepting our items list (that Treehouse is sending us). Now for every item in items we need to evaluate it to see if the first letter is "a". If it is, we skip it. Otherwise, we print it out. Hope this helps! :sparkles: