Lesson 12 need help please


#1

also please dont just give me your code that is not letting me learn
i need to learn so please help me out

n = [3, 5, 7]

for i in range(0, len(n)):
    print n[i]
    
def print_list(x):
     for i in range(0, len(x)):
         
         print x[i]
print_list(n)

the error is
Oops, try again. The body of your function should not contain any references to 'n'


#2

Try to remove this loop here:


#3

its hard to help you when we dont know what the goal of the lesson is :confused:

is it this one? Printing out a list item by item in a function


#4

it looks to me that there may be a bug in the automatic evaluation script. I'm having the same problem. Clearly there is no mention of variable n inside the function but the error says otherwise.


#5

This worked, but it is not clear in the instructions that the original code must be moved inside the function. The instructions suggest that copying it would also work. but it doesn't


#6

Yeah, they want you to put the existing code into your function, but you have to change the code so that it uses x as a parameter instead of directly referencing n.

Initially, I tried doing the following

def print_list(x):
    for y in x:
        print y
n = [3, 5, 7]
print_list(n)

which does exactly the same thing (with a little more elegance, in my opinion), but it is not accepted as the answer.