Error in 'Printing out a list item by item in a function'


Hi everybody, I've got stuck in this python program

I'm getting the error:
"Oops, try again. The body of your function should not contain any references to 'n' "

My code is as below

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]

Please help me !!!


Why are you using this part?

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

This is what your function is supposed to do anyway.


Thanks a lot.It sovled the problem


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