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

Joshua Briggs
Joshua Briggs
426 Points

Not sure what to do here

Ive looked through the video a few times however i just feel like im missing something obvious? What do i need to correct it?

breaks.py
def loopy(items):
    for word in items:
        print(word):
            if word == 'STOP':
                break

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're right.. you're super close here. First, check your indentation. The if statement should be indented inside the for lop but it shouldn't be inside anything else. Secondly, if you fix that part, something else will be happening. You have the order set to print the item and then check if it's "STOP". This means that when it gets to "STOP" it will first print "STOP", which isn't exactly what they're wanting. They want you to stop printing the items when the word is equal to "STOP". Rethink the order of checking the word and printing the word.

Also, the line with print(word) does not need a colon at the end. It is a statement by itself and not beginning a block of code.

Hope this helps, but let me know if you're still stuck! :sparkles:

Joshua Briggs
Joshua Briggs
426 Points

Thanks for the help!