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 trialDebdipta Dasgupta
431 PointsHow to solve this challenge
Can't understand where I am going wrong. Thanks in advance.
def loopy(items):
if items=="STOP":
BREAK
for man in items:
print(man)
1 Answer
Ryan Ruscett
23,309 PointsHey,
it's like this
- We need a for loop to iterate over the items. So this means the first thing we do is iterate over the items.
def loopy(items):
for item in items:
- Now, if item is STOP we need to break the for loop
def loopy(items):
for item in items:
if item == "STOP":
break
- If the item isn't STOP than we need to continue to print the items.
def loopy(items):
for item in items:
if item == "STOP":
break
print(item)
Does that make sense?
Debdipta Dasgupta
431 PointsDebdipta Dasgupta
431 PointsThank you so much