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 trialAlex Deltomme
1,628 PointsWhat am I doing wrong?
So for some reason, i get "Bummer! Try again!". It seems to me that my code is correct, so what's the problem?
def loopy(items):
for item in items:
if item == "STOP":
break
print(item)
2 Answers
Vladimir Vasconcelos
Courses Plus Student 6,433 PointsI think you are trying to use the code of the second part of the challenge first.
Try in the first part only this:
def loopy(items):
for item in items:
print(item)
After that, use the STOP conditional as required:
def loopy(items):
for item in items:
if item == "STOP":
break
print(item)
Peace
Ezra Siton
12,644 Pointsindentation error. You have one extra space before "break" that's it :) (use tabs)
def loopy(items):
for item in items:
if item == "STOP":
break
print(item)
list = ['apples', 'pears', 'STOP', 'peaches', 'beer']
loopy(list)
Alex Deltomme
1,628 Pointsi used the exact same code and it still gives me "Bummer! Didn't find the right items being printed." :(