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

Alex Durham
PLUS
Alex Durham
Courses Plus Student 456 Points

for loop

can someone help me set up this for loop thanks!

breaks.py
def loopy(items):
    for x in range items 

2 Answers

Grant Tribble
Grant Tribble
8,210 Points

Hi Alex, It's a little more direct when you're iterating through something specific. Just take out the range and let the for loop go straight to work on that list. It will look like this:

    for item in items:
        print(item)

This can be shortened even further with a lambda, but that happens a little down the road.

Alex Durham
Alex Durham
Courses Plus Student 456 Points

thanks for the help but i typed in exactly what you have and it still says that it is in correct

Grant Tribble
Grant Tribble
8,210 Points

Did you forget to put it in the function def?

Alex Durham
Alex Durham
Courses Plus Student 456 Points

that was already given i did not have the 'for' indented correctly