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

My code works in the workspaces, but not in the challenge

I tried this in the workspaces (I added a list and the function call) and it worked fine. However here it says: "Didn't find the right things in items". What's happening?

breaks.py
def loopy(items):
    # Code goes here
    for thing in items:
      print(thing)
      if thing == "STOP":
        break

2 Answers

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey Wilfredo,

you were on the right track and almost got it right! But you should print out the current item in the end. Right now you'll print out "STOP" as well and after you printed it out it will stop but you should immediately stop the loop when the current item is "STOP" without printing it out. So if you switch your if block and the print statement it should work.

def loopy(items):
    # Code goes here
    for thing in items:
      if thing == "STOP":
        break
      print(thing)
Ham Hamey
Ham Hamey
5,712 Points

exactly you need to print the thing as Wilfredo said