Code doesn't work


#1


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


The code gives an error like "The body of the function should not contain any references to 'n'"


Replace this line with your code. 
Can't solve 12th challenge

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)


#2

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

You need to delete this part of the code.

Reason:
Its written in instruction..

Inside that function, print out each element one by one. Use the existing code as a scaffold.

It means you have to use same structure(as for loop example) for your program but have to remove it.


#3

Oh.... This is weird.

I tried this thing by commenting out those two lines of codes. However, it doesn't work if you comment them out. It works only if you delete them.

I tried to comment them out but didn't work earlier, but this time deleted and it works.

Thanks.


#4

Yeah, The reason as I mentioned was in the instructions.


#5

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