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

yunus emre erdem
yunus emre erdem
575 Points

i don't understand what is problem

hey thanks for helping me out

breaks.py
def loopy(items):
    # Code goes here
    for things in items:
        print (things)
        if things = "STOP":
        break
yunus emre erdem
yunus emre erdem
575 Points

Also could you help me about that one?

def loopy(items): # Code goes here for things in items: print (things) for things in items: things = "STOP" break break

I think error is in "if things = "STOP": try: if things == "STOP":

2 Answers

Timothy Donley
seal-mask
.a{fill-rule:evenodd;}techdegree
Timothy Donley
Python Web Development Techdegree Student 1,365 Points
def loopy(items):
    for things in items: 
        if things == "STOP":
            break
        else:
            print(things)

This is the correct code for all the tasks. The first problem that I see is you are printing things before you check is it "STOP". The spacing is also wrong as well. Remember the spacing is using logic for the computer to read what the code is trying to do. Also Reminder in a function the order is how its read.

yunus emre erdem
yunus emre erdem
575 Points

thanks timothy for this and previous one