Python: range doesn't increase
<p>I have to write a program that shows a column of kilograms and a column of pounds, starting at 1 kilogram and ending 99, increasing every step with 2.</p>

<p>I have the following code, and the range() works for the pounds part, but not for the kilograms part. It stays always 1 for the kilograms.</p>

<pre><code>for k in range(1,3,1):
    print("Kilograms","Pounds",sep="        ")
    for i in range(1,101,2):
       for j in range(2,223,3):
           print(i,"",j,sep="        ")
       break
    break
</code></pre>

<p>Also, why can't I use floats in the range, because officially it is 2.2 pounds.</p>

<p>Thanks in advance!</p>

<p>First off, remove the breaks, as those will prematurely end the loops iterations. Secondly, why are you using nested <code>for</code>loops?</p>

<p>For what you described, nested loops are not even required. You simply need to use <strong>one</strong> <code>for</code>loop. Use <code>range()</code> <strong>once</strong>, to step through the values <code>1</code> to <code>99</code> in increments of <code>2</code>.</p>

<p>From you description, something such as this should suffice:</p>

<pre><code>for i in range(1, 100, 2): # for the numbers 1-99, going by twos
    print('pounds: {} kilograms: {}'.format(i, i * 2.2)) # print pounds, print kilograms
</code></pre>

<hr>

<p>You seem to be confused about loops in python and he builtin <code>range()</code> function. I recommend looking at the official Python documentation for both:</p>

<ul>
<li><a href="https://docs.python.org/3/tutorial/controlflow.html#for-statements" rel="nofollow">Python documentation for <code>for</code> loops</a></li>
<li><a href="https://docs.python.org/3/reference/simple_stmts.html#break" rel="nofollow">Python documentation for <code>break</code> statement</a></li>
<li><a href="https://docs.python.org/3/library/stdtypes.html?highlight=range#range" rel="nofollow">Python documentation for <code>range()</code> function</a></li>
</ul>

python for-loop