Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Break

Lalit Aditya
Lalit Aditya
400 Points

I need you to help me finish my loopy function. Inside of the function, I need a for loop that prints each thing in item

What was wrong in my code?

breaks.py
def loopy(items):
    # Code goes here
    for item in items:
        print(item)
        loopy(['apple', 'mango'])

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,845 Points

You don't need to include the data in your code. Remove the loopy array and the code will pass!

The code challenge will assume the data exists! :-)

Lalit Aditya
Lalit Aditya
400 Points

I removed the loopy array but it did not work. It gave the error "loopy() missing 1 required positional argument: 'items' ".!!!

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,845 Points

That's weird.

This code below is enough for me to pass Task 1. It doesn't really ask for an array, nor does the 2nd task.

def loopy(items):
    # Code goes here
    for item in items:
        print(item)
Lalit Aditya
Lalit Aditya
400 Points

Thanks Jonathan, it worked!!!!