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 trialYusuf Cattaneo
522 PointsWhat am I doing wrong?
???
def loopy(items):
# Code goes here
for items in loopy:
print(items)
2 Answers
Steven Parker
231,269 PointsBe careful with indentation.
Anything that is part of a function must be indented. As soon as you start another line on the left edge, Python thinks the function is complete.
That "# Code goes here
" comment line is a hint about how far to indent. I'll bet you can get it now without an explicit spoiler.
Yusuf Cattaneo
522 PointsSteven and Bruno Thanks for the explanation!
Bruno Correia
3,114 PointsBruno Correia
3,114 PointsHi Yusuf,
There a few issues. First, remember indentation is important. As the code is at the moment, the for loop is not part of the loopy function you are building. Secondly, "loopy" is just the name of the function, not the iterable variable you want to loop. That would be the variable "items" that is passed as an argument (inside parenthesis) of the function. Give this a try and do let me know if there's still something you are not quite sure about: