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 trialSreejith Unnikrishnan
2,407 PointsThe solution check seems not be working correctly. When i run the code in python interpreter, it seems to be working
Well the solution asks to iterate through the item list and then to break the loop when it finds "STOP". I believe the code does that, however the grader seems to say incorrect every time, any thoughts?
def loopy(items): ... # Code goes here ... for i in items: ... if i == "STOP": ... break ... else: ... print i ... loopy(["hello", 5, "STOP", "there"]) hello 5
def loopy(items):
# Code goes here
for i in items:
if i == "STOP":
break
else:
print i
3 Answers
jcorum
71,830 PointsSo close!!
def loopy(items):
# Code goes here
for i in items:
if i == "STOP":
break
else:
print(i)
print is a function
jcorum
71,830 PointsYes! Shades of Swift 1 vs Swift 2
Sreejith Unnikrishnan
2,407 PointsThank you so much!, Python 2 vs Python 3 in action :)