Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Break

not sure what I'm missing

I've added the for loop and called the function to finish it..... I'm not sure if i need to input any items somewhere - doesn't work in the parenthesis at the end calling the function? or to create an input?

help :)

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

loppy()

1 Answer

Emre Havan
Emre Havan
8,569 Points

Your first mistake is you are trying to use the function name for your iteration which is loopy. You need to make it in a way such that the function can iterate all the items in there, when its called so you should do it like: "for i in items". Then it should work.

Answer for both the first and the second task:

def loopy(items):
    for i in items:
        if i == "STOP":
            break
        else:
            print(i)
Steven Parker
Steven Parker
221,328 Points

Try formatting your code so the spacing shows up (in Python, indentation is everything).
Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:
Or watch this video on code formatting.

ahhhh----I get it...thanks!