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 trialAustin Jimison
3,849 Pointswhat's wrong with my loop, and break statement?
is my indentation incorrect?
def loopy(items):
# Code goes here
for item in items:
print (items)
if item == "STOP":
break
2 Answers
Phillip Kerman
Courses Plus Student 285 PointsWorks for me, but I think you're SUPPOSED to have indentations in multiples of 4:
def loopy(items):
for item in items:
print (item)
if item == "STOP":
break
Hassaan Ahmad
1,979 PointsHey, your indentation is fine. The problem is that you are calling to print the items in your code instead of item
Hassaan Ahmad
1,979 PointsHassaan Ahmad
1,979 PointsHey Phillip, it's not necessary to keep the indentations in multiples of four. It's just a common practice. You just have to keep the same indentation for a code block.