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

A bit lost on this one.

In the video, we created a shopping list then 'break' at DONE. Do I need to create a shopping list with this question as well? I am confused as to what is being asked.

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

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

You code suffers mostly from indention issues and the print should be after the if ... 'STOP':

def loopy(items):
    # Code goes here
    # indent to 4-spaces
    for item in items:  # <-- add missing colon
        # move if inside loop to break loop if 'STOP' seen
        if item=='STOP':  # <-- add missing colon
            break
        print(item)

Edit changed to loop to for item in items

Thanks Chris,

I tried it and it still doesn't work. I noticed I had 'item' instead of 'items' in my earlier code so I switched to items instead still with no luck.

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

I believe everything is indented correctly, but might have something slightly off. Thanks again for the help.

Jovan Dandridge
Jovan Dandridge
12,835 Points

just change in loopy to in items