Printing out a list item by item in a function


#1



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


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


I don't have any reference to n in my function, so WTF? :frowning:


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

They are referring to this above your function. Best to remove that since it's a repetition of what's in your function.


#3

Oh okay. That was confusing. Thank you!


#4

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