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 trialJunior Mateus
2,784 PointsI need you to help me finish my loopy function. Inside of the function, I need a for loop that prints each thing in item
here is my answer to the question, i don´t know if it´s incorrect
def loopy(items): for i in items: print i loopy(items)
def loopy(items):
# Code goes here
for i in items:
print i
loopy(items)
3 Answers
Junior Mateus
2,784 PointsYes it´s correct , Thx u very much!
SC3 Rocks
33,474 PointsI tried using the same code for this same exercise, and it didn't work for me, for some reason - Did I miss something?...
def loopy(items):
# Code goes here
for i in items:
print(i)
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 PointsHi SC3!
The for loop needs to be inside the function and in Python, that means the for loop has to be indented by one tab to be inside. Hope that helps! Let me know if you have any more problems :).
SC3 Rocks
33,474 PointsOkay, that worked - Thank you, Alexandra... P :)
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 PointsAlexandra Barnett
Front End Web Development Techdegree Graduate 46,473 PointsHi Junior! You almost had it right! Your print function needs brackets and you don't need to call the function at the bottom: