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

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
229,744 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!