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

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 91,253 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 91,253 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!!!!