Is this a bug? I can't continue


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/3/1?curriculum_id=4f89dab3d788890003000096#


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


I expect that I shouldn't receive any error messages, and that the code should work perfectly.

Here is an image of the error message:


n = [3, 5, 7]

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

print_list(n)

def print_list(x):
    for a in x:
        print(a)


#2

Try calling print_list(n) after defining the function rather than before.


#3

Thanks for the quick reply!

I tried that as well, but I'm still getting the same error:


#4

Is the initial for-loop supposed to be there still?


#5

I think the problem is in the position of the defined function. Why don't you try defining the function after the list and thereafter code the for loop? I think that's simply it.


#6

I believe so. I tried commenting it out, but I still run into the same error:


#7

Thanks for the idea. However, I still run into the same error:


#8

I've found a solution. I just changed the function to more closely resemble the for loop that was given, and removed the previous for loop.Thanks everyone for your help!

Keeping the for loop there, it has the similar previous error:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.