 <p>Try this instead:</p> <pre><code>try: user = int(raw_input('Enter: ')) # Cannot compare a string with an integer. except ValueError: print('Input should be an integer!') i = 1 while True: i += 1 if i &gt; user: break print(i) </code></pre> <p><strong>Note:</strong> In your code, even if we were to explicitly declare the <code>input</code> as an integer it would still not quite work the way you want it to. This is because in your code the <code>while</code> loop stops once <code>i</code> is equal to <code>user</code> (as the condition is <em>while less than...</em> and will thus not print out the final value, <code>user</code>. I therefore modified it so it breaks at the point where <code>i</code> is greater than <code>user</code>, meaning that the last printed value will be equal to <code>user</code>.</p> <p>Example previous output where <code>user = 5</code>:</p> <pre><code>1 2 3 4 </code></pre> <p>And with the new code:</p> <pre><code>1 2 3 4 5 </code></pre> <p>It is however better to use a <code>for</code> loop here, if you are not set on using a <code>while</code> loop:</p> <pre><code>for i in range(1, user+1): print(i) </code></pre>