How is it possible to use a while loop to print even numbers 2 through 100?
<p>I am a beginner and I am stuck on this problem, "Write a python code that uses a while loop to print even numbers from 2 through 100. Hint ConsecutiveEven differ by 2."</p>

<p>Here is what I came up with so far: </p>

<pre><code> while num in range(22,101,2):
              print(num)
</code></pre>

<p>Here is how to use the while loop</p>

<pre><code> while [condition]:
     logic here
</code></pre>

<p>using while in range is incorrect. </p>

<pre><code>num = 0
while num &lt;=100:
    if num % 2 == 0:
        print(num)
    num += 1
</code></pre>

python loops while-loop