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 triallizeth jurado
1,379 Pointsbreaks python
Hi community!. I have a problem in my code and I do not what happen!!, Could anybody help me? , The indentation is correct and the quotes too.
def loopy(items):
# Code goes here
for item in items:
if item == "STOP":
break
else:
print(item)
2 Answers
Alexander Davison
65,469 PointsHi Lizeth,
Your code is working fine on the second task. You have to write the code that will pass the first task and then write the code you have just written. You must do exactly what the challenge asks you for :)
You only need to write this for task 1:
def loopy(items):
for item in items:
print(item)
After you pass that task, you write what you have just written:
def loopy(items):
for item in items:
if item == "STOP":
break
else:
print(item)
I hope this helps. ~Alex
Ash Singh
12,548 PointsI checked it on my IDE and it works for "STOP" that is it breaks out of the item array but does not work for "Stop". Python is case sensitive
Alexander Davison
65,469 PointsActually, the challenge is ONLY expecting you to break if the item is uppercase "STOP".
Therefore, changing case doesn't matter for this situation.
lizeth jurado
1,379 Pointslizeth jurado
1,379 PointsThank you everyone for your help :) , it works well