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

hi guys

def loopy(items): # Code goes here items=['abz', 'xyz'] if index[0] in items=='a' continue else" print(item)

breaks.py
def loopy(items):
    # Code goes here
    items=['abz', 'xyz']
     if index[0] in items=='a'
        continue
        else"
        print(item)

2 Answers

Rich Zimmerman
Rich Zimmerman
24,063 Points

The "items" list is passed into your function when it is called. So while you don't have an actual value for "items", you know it's going to be a list of values. So you want to run your function through it accordingly. like this:

for item in items:
    # item is the value of the item in the array for each index, so item[0] is index 0 of the word that's being passed as 'item'
    if item[0] == 'a':
        continue
    else:
        print(item)
FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

you need to first loop through each item in "items", its better if you use the "for loop" to do that and also you need to target the first item and test if it is equal to the string 'a', you use the "if" statement for that and if your first item in your list is not equal to the string 'a', then use the "else" statement to print that item

see the code from Rich Zimmerman for step by step clearity