Contain any references to 'n'


#1



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


It says the body of your function should not contain any references to 'n'


Well jeepers, the instructions specifically tell me to call the function with the argument n


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

this code:

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

provided by the exercise, you could have used it to create the function (so the provided code becomes part of the function), since you didn't, you will have to remove it, since it now causes the error message.


#3

thank you, but this is not working either. It says "It looks like you either didn't call print_list(n) or there is something wrong because 5 wasn't printed." See code below

n = [3, 5, 7]

def print_list(x):
    for i in range(0, len(x)):
        return x[i]
print print_list(n)

#4

for some reason you decided to use return here:

return x[i]

when a return keyword is reached, a function ends, even if in the beginning/middle of a loop. So your loop ends in the first iteration.


#5

that was it. thanks so much!!!!


#6