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

yusuf patat
yusuf patat
572 Points

i couldn't find answer

i couldn't find the answer

breaks.py
def loopy(items):
    items=input("> ")
    if items.index(0)=="a"
        continue
    print(items)
    # Code goes here

1 Answer

Chris Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Jones
Java Web Development Techdegree Graduate 23,933 Points

Hi Yusuf,

Good try! A couple things to consider:

First, items is the function's parameter, so someone will provide items for the function when calling your loopy function. So, you don't need to change the items parameter with this line:

items=input("> ")

I know this can be a difficult concept to understand because it requires you to think outside of the code you're writing and how your code will be used by others. Stick with it - you'll get it :)!

Second, if you create a for loop, you need to finish the line with a colon (:), so this line:

if items.index(0)=="a"

needs to be:

if items.index(0)=="a":    # notice the colon at the end of the line. 

The code challenge tells you that the items parameter will be list of strings(["abc", "xyz"]), so we want to loop through each of the list items, like so:

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

Notice that there is also no index method for a string. If the first character in a string is needed, write item[0].

I hope this helps! Let me know if you have any more questions! Keep it up :)!!