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

Jesse Ferguson
Jesse Ferguson
1,419 Points

help what did I do wrong here

I think I did everything I was supposed to but it still says something's wrong

breaks.py
def loopy(items):
    if items[0] == 'a':
        .remove('a')
        print(items)

    # Code goes here

1 Answer

Hey Jesse,

Let's take a look on what the task is asking us to do. First, it wants us to iterate over the elements in 'items'. Than, if that current element that we are on, starts with the char 'a', it want's us to do nothing, and just continuing iterating through. So first, let's write our for loop to iterate the 'items'.

for item in items:

Now we have to set the if statement to check if the first char in the item is equal to 'a':

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

Ok, so now all we need to do is tell the function to continue if that if statement is true, else we need to print the item. So it looks something like this:

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

Let me know if this works for you!