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 trial

Python Python Basics (2015) Shopping List App Break

cant 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

breaks.py
def loopy(items):
  for thing in loopy:
    print loopy

2 Answers

HI, 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
Justin Olson
13,792 Points

Hey 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!