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 trialjamie Macdiarmid
2,048 PointsSecond time around. Still got it wrong!
Am I Close?
def loopy(items):
for word in items:
if word == "STOP"
break
else:
print(word)
1 Answer
akak
29,445 PointsYou are close but need to make a few changes. Remember that indentation and colons are important in Python.
def loopy(items):
# Code goes here
for word in items:
if word == "STOP":
break
else:
print(word)
jamie Macdiarmid
2,048 Pointsjamie Macdiarmid
2,048 PointsThanks akak.
jamie Macdiarmid
2,048 Pointsjamie Macdiarmid
2,048 PointsWhat is the best way to think of colons? Is it for every 'function'?
akak
29,445 Pointsakak
29,445 PointsBasically you put a colon before indenting to next line to indicate a code block start. And you do indent when you write a function so you can say it's for every function but also conditionals, loops and everywhere indentation is needed.