12.Printing out a list item by item in a function



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

I do not understanf where this error come from.

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]



the code provided by the exercise:

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

should have been used for the function, you wrote a new loop, which is fine, but then you have to remove the loop provided by the exercise (code i posted)


Thank you very much!! It solved my problem.


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