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 trialJoshua Briggs
426 PointsNot sure what to do here
Ive looked through the video a few times however i just feel like im missing something obvious? What do i need to correct it?
def loopy(items):
for word in items:
print(word):
if word == 'STOP':
break
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're right.. you're super close here. First, check your indentation. The if
statement should be indented inside the for
lop but it shouldn't be inside anything else. Secondly, if you fix that part, something else will be happening. You have the order set to print the item and then check if it's "STOP". This means that when it gets to "STOP" it will first print "STOP", which isn't exactly what they're wanting. They want you to stop printing the items when the word
is equal to "STOP". Rethink the order of checking the word and printing the word.
Also, the line with print(word)
does not need a colon at the end. It is a statement by itself and not beginning a block of code.
Hope this helps, but let me know if you're still stuck!
Joshua Briggs
426 PointsJoshua Briggs
426 PointsThanks for the help!