title: Use value of a variable as counter in python 3
body: <p>I want to take an input from the user and and store it in a variable, lets say <code>k</code>. Then use this <code>k</code> as a counter for a <code>for loop</code>.</p>
  
  <p><code>while i&lt;k:</code> doesn't work!
  code:</p>
  
  <pre><code>k= input('number of points:')
  p=[]
  i=0
  while i&lt;k:
  x=float(input('Enter value='))
  p.append(x)
  i=i+1
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>number of points:3
  Traceback (most recent call last):
  File "/home/ramupradip/tes.py", line 4, in &lt;module&gt;
  while i&lt;k:
  TypeError: unorderable types: int() &lt; str()
  </code></pre>
  
  <p>I also tried using range </p>
  
  <pre><code>for i in range(1,k)
  </code></pre>
  
  <p>which gave me an error:
  Traceback (most recent call last):
    File "/home/ramupradip/reflect.py", line 6, in 
      for i in range(1,k):
  TypeError: 'str' object cannot be interpreted as an integer </p>