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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![De Juan Evans-Taylor](https://secure.gravatar.com/avatar/fe5c3d3b0ca7d6b74bb2425727b1e3cd?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
De Juan Evans-Taylor
901 PointsNot understanding the challenge task for "break" in the python track
def loopy(items): if items == "STOP": break for i in items: print(i)
def loopy(items):
if items == "STOP":
break
for i in items:
print(i)
# Code goes here
1 Answer
![jcorum](https://uploads.teamtreehouse.com/production/profile-photos/4188262/micro_jgc_photo.jpg)
jcorum
71,830 PointsThings are a bit out of order. The if else needs to be inside the loop:
def loopy(items):
# Code goes here
for i in items:
if i == "STOP":
break
else:
print(i)
What this is saying is that for each i in items, if it is STOP then break, otherwise print it.
De Juan Evans-Taylor
901 PointsDe Juan Evans-Taylor
901 Pointsthank you!