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

Cannot get this one to work!

This code is very simple but I can't get it to work. If anyone could quickly see why this basic python isn't running would be really appreciated. Thanks.

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

loopy()

1 Answer

Steven Parker
Steven Parker
231,248 Points

:point_right: It looks like you have three issues:

  • you have an extra print(item) (the first one) — remove it
  • everything below the removed line needs to be indented one more level to be part of the if
  • finally, don't call loopy yourself (particularly with no argument!), the challenge does it's own call