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 trialAkua Agyeman
532 Pointscant figure out loop
i am asked to get loopy fcn to print. I have put a for loop to get loopy function to print but no luck
def loopy(items):
for thing in loopy:
print loopy
2 Answers
taejooncho
Courses Plus Student 3,923 PointsHI, there!
I think you misunderstood the challenge.
First, when you write for loop you are not looping at the function loopy, but at the iterable items.
Second, the challenge is asking you to print items not function loopy.
Third, when you call a print function it needs () after print. So if you want to print items you should write print(items) not print items
Justin Olson
13,792 PointsHey bud!
You are just about there. Basically, loopy is the function, but you want to loop the stuff inside the function (the 'items'). In addition, you want to call the function and add an item. Review my code below:
def loopy(items):
for thing in items:
print(thing)
loopy('car')
The 'for thing in items', is the loop. For every 'thing' that is within 'items', it will print. When I call the function, I add the item 'car'. This will spell out each character within car.
I hope this helps out!