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!
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
Debasis Nath3,316 Points
again what is wrong in this code?
it"s showing bummer.
def loopy(items): # Code goes here for item in items: print(items) if items="STOP": break
Stuart Wright41,117 Points
There are a couple of things to fix here:
1 - 'items' is the entire list, and 'item' is the current element in list. It is 'item' that you should be checking in your if statement, not 'items'. Same for the print statement - you should only be printing 'item'.
2 - The challenge does not want you to print the 'STOP' item, so the if condition with break statement should come before the print statement, and only if the item is not 'STOP' should it be printed. Also, be careful with your indentation - anything inside an if block should be indented, which you have not done correctly with your break statement in the current code.