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

I cant see where I did wrong

I can't figure out how to do this thing

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

1 Answer

Samuel Ferree
Samuel Ferree
31,722 Points

you've made a few syntax errors. You need a "for" statement to start an iteration. your print statement is tabbed over to far and falls under your if statement, but it will never execute as it is preceded by a continue statement. Your function and iterator also have the same name, it's considered standard to name your iterator the singular of your list name.

def loopy(items):
  for item in items: # use the singular of items as our iteration variable
    if item.index(0) = "a":
      continue
    print(item) # reduce tab count so this isn't part of the if block

Note: This just fixes your code, it doesn't necessarily pass the challenge. My enrollment is currently paused and I can't see exactly what the conditions are.

Thank you very much :D but I still haven't passed the challenge.

This is the full challenge:

Same idea as the last one. My loopy function needs to skip an item this time, though. Loop through each item in items again. 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".