How to stop Python 3 printing none
<p>how do I stop this from printing none at the end. Or is it inevitable? </p>

<pre><code>x = int(input("Please enter a number to print up to."))
def print_upto(x):
for y in range(1,x+1):
    print(y)
print(print_upto(x))
</code></pre>

<p>Many thanks.</p>

<p>Your function does not return any value, it just <code>print</code> it. So return value is <code>None</code>. And when you <code>print(print_upto(x))</code> it's equal to <code>print(None)</code></p>

<p>And if you want to see printed values you just need to call <code>print_upto(x)</code> without any <code>print()</code></p>

python