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 trialGuy Shafer
650 PointsPython Basic Coding Challenge
def loopy(items): for thing in items: print(thing) if thing == "STOP": break loopy(["Louie", "Chewie", "STOP", 1955])
def loopy(items):
for thing in items:
print(thing)
if thing == "STOP":
break
loopy(["Louie", "Chewie", "STOP", 1955])
1 Answer
Katie Wood
19,141 PointsHi there,
You're close - first, the "if" block needs to be moved above the "print" line - that way, if the entry is STOP, it won't print it because it will break before it gets there. I think you've got it right otherwise.
Hope this helps!
Guy Shafer
650 PointsGuy Shafer
650 PointsThank you!