# Why does it say n should not be used in the body of my function when it isn’t?

#1

## Question

Why does it say n should not be used in the body of my function when it isn’t?

This seems to be an error present in this exercise at the time of writing. If you leave the initial `for` loop code as it is and write your `print_list` function after it, it marks your code incorrect even if it is the right solution.
To work around this, delete the initial `for` loop and the `print` statement inside of it and try running your code again.
If that doesn’t work, check to make sure you are iterating using `x` as your list you’re checking and `print`ing values from, and that you are using your function by calling `print_list(n)` at the end, outside of any functions (unindented).

FAQ: Learn Python – Lists and Functions – Printing out a list item by item in a function
#2

In this exercise, after running the function print_list(n) in the console I got the values 3,5, and 7 printed individually, but I also got “None” printed on the last line. What does it mean?The program runs smoothly and does not show any error message, is this a Semantic Type of error ?

#3

I have the same question about why None gets printed after the each number.

#4

I wrote the program differently, but it still works. Why?

n = [3, 5, 7]
def print_list(x):
for x in range(0, len(n)):
print n[x]

#5

it doesn’t work, look:

``````n = [3, 5, 7]
def print_list(x):
for x in range(0, len(n)):
print n[x]

print print_list([2, 4, 6])
``````

it should print:

``````2
4
6
``````

which is not happening.

the function should be capable of printing any list you provide as argument at function call

#6

Got it. Thanks for your help!

#7

That’s because function `print_list(n)` returns None. It prints the whole list and returns None.