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

i dont know what is wrong here.... please someone can help me?

def loopy(items): for item in items: if item == "STOP": break for item in items: print(items)

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
        if item.upper() == "STOP":
            break
    for item in items:
        print(item)

3 Answers

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

Hi there! You're doing well here, but you only need one for loop. Right now, your code checks the item and if it's "STOP" then it continues on to the next for loop where it prints out every item including "STOP". There is one extraneous line here, and if I delete it your code passes.

I think you can get it with these hints, but let me know if you're still stuck! :sparkles:

hello Jennifer!! thank you very much for replying me....i delete the extraneous for loop line but i still stuck!!, the always say :"didn't find the right item being printed def loopy(items): for item in items: if item == "STOP": break print(items)

here is the code i rewrite!!

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

Hi! If properly indented your code passes for step two with one minor correction. You now have changed print(item) to print(items). Change "items" back to "item" :thumbsup:

yeahhhhhhhhhhh i got it now...thank you very much Jennifer