python - adding a counter in a for loop
<p>My aim is to print the next 20 leap years. </p>

<p>Nothing fancy so far.</p>

<p>My question is : </p>

<blockquote>
  <p>how to replace the <code>while</code> with a <code>for</code></p>
</blockquote>

<pre><code>def loop_year(year):
    x = 0
    while x &lt; 20:
        if year % 4 != 0 and year % 400 != 0:
            year +=1
            ##print("%s is a common year") %(year)
        elif year % 100 != 0:
            year +=1
            print("%s is a leap year") % (year)
            x += 1


loop_year(2020)     
</code></pre>