Print function input into int
<p>My goal is very simple, which makes it all the more irritating that I'm repeatedly failing:</p>

<p>I wish to turn an input integer into a string made up of all numbers within the input range, so  if the input is <code>3</code>, the code would be:
<code>print(*range(1, 3+1), sep="")</code> </p>

<p>which obviously works, however when using an <code>n = input()</code> , no matter where I put the <code>str()</code>, I get the same error: </p>

<pre><code>"Can't convert 'int' object to str implicitly"
</code></pre>

<p>I feel sorry to waste your collective time on such an annoyingly trivial task..</p>

<p>My code:</p>

<pre><code>n= input()
print(*range(1, n+1), sep="")
</code></pre>

<p>I've also tried list comprehensions (my ultimate goal is to have this all on one line): </p>

<pre><code>[print(*range(1,n+1),sep="") | n = input() ]
</code></pre>

<p>I know this is not proper syntax, how on earth am I supposed to word this properly? </p>

<p><a href="http://www.secnetix.de/olli/Python/list_comprehensions.hawk" rel="nofollow">This</a> didn't help, ditto <a href="http://stackoverflow.com/questions/19352888/print-function-in-python3">this</a>, ditto <a href="http://stackoverflow.com/questions/13654168/typeerror-cant-convert-int-object-to-str-implicitly">this</a>, I give up --> ask S.O.</p>

<p>In your code, you should just be able to do:</p>

<pre><code>n = int(input())
print(*range(1,n+1),sep="")
</code></pre>

<p>But you would also want to have some error checking to ensure that a number is actually entered into the prompt.</p>

<p>A one-liner that works:</p>

<pre><code>print(*range(1, int(input()) + 1), sep="")
</code></pre>

python python-3.x