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

fisnik poroshtica
fisnik poroshtica
14,154 Points

I don't understand this

I am not understading what it asking to do exactly?

breaks.py
def loopy(items):
    # Code goes here
    for item in items
        print(item)
    break   

1 Answer

andren
andren
28,558 Points

It wants the loop to stop when the item the loop is going though equals the string "STOP". Doing that will require that you place an if statement inside of your loop that checks if the content of the item variable equals "STOP", if it does you should use the break keyword, as that will result in the loop stopping immediately.

Do also note that the if statement has to come before the print statement in order to complete the challenge.