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

Whats going on! **help meee**

Please help I dont understand what i'm doing wrong I thought i was doing it right but it seems like the code challenge said BUMMER! help me ;-;

breaks.py
def loopy(items):
    for loopy in items:
        print(items)

        if loopy == 'STOP':
            break

2 Answers

Vidhya Sagar
Vidhya Sagar
1,568 Points

Sorry ,it was your code which i altered. NOW i entered my code and checked and its working fine.

def loopy(items):
    for item in items:
        if item.lower()=="stop":
            break
        print(item)

Thanks Vidhya,

Now I can FINNALY move on Thank you so much Vidhya!

(Best Answer AND a 1+ :D)

Vidhya Sagar
Vidhya Sagar
1,568 Points

It is a top down approach.So in your code it'll print the item irrespective of the condition ,since it is below print. Try this.

def loopy(items):
    for item in items:
        if item.lower()=="stop":
            break
        print(item)

Thanks Vidhya, But it seems that your code doesn't work on the first task nor the second task