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

Cant figure out whats wrong with my break code

I keep reading that the indentation is wrong but im not seeing it, any explanation would be wonderful and much appreciated!

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

3 Answers

Hi there!

Your if block is outside your else block, just indent the if block to line up with the code inside the for loop (the print statement)

Hope it helps!

well i indented and i got an error back saying "didnt find the right items being printed"

I suspect it's because at the moment your code prints out "STOP" then checks if it's there?

yea i cant figure it out for the life of me and im looking all around and people having the same issue :P

FINALLY, i forgot the freaking ":" at the end of my if statement that checks for the string "STOP"