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 trialEddie Black
1,670 PointsDidn't find the right items being printed
I'm receiving the above error message, any help will be appreciated
def loopy(items):
# Code goes here
for things in items:
if things == 'STOP':
break
print(items)
1 Answer
Idan Melamed
16,285 PointsHi Eddie, you are pretty close!
A few things I can remark on:
- The variable items is a list. The variable things only store one thing from item at a time. So you might want to change 'things' to 'thing' (or better yet: 'item'). It won't effect your code, but it will make it more readable to other programmers.
- You need to indent the last line back, so it start from the same position as the if statement.
- You want to print things (or, again, item).
The end result should look something like this:
def loopy(items):
# Code goes here
for item in items:
if item == 'STOP':
break
print(item)
Eddie Black
1,670 PointsEddie Black
1,670 PointsThank you, #2 was the issue and also changing the variable to item