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 Break

Carole Cox
Carole Cox
429 Points

This looks correct???

I can't see what I am missing. My code appears to meet the challenge and what it asks for. My syntax looks correct. What am I missing?

breaks.py
def loopy(items):
  items= []
  for item in items:
    print item
  if item = "STOP":
    break


    # Code goes here

1 Answer

I am not a python expert but based off the challenge, you need to break when the array has stop. Right now your loop is only printing items and the line after the loop is testing if item has stop in it. If I remember correctly python is a whitespace language and the if and for loop are on the same indentation level. Secondly, you want to test if the item has stop before you print and if it doesn't then print. So you want to use an if else here