printing out date in uniform order and a counter
<p>I have been doing these for hours! please help! New to python</p>

<p>example 1990 for input year
and 2000 for end year.</p>

<p>basically i want the output to be </p>

<blockquote>
  <p>the years are 1992 1996 2000 </p>
  
  <p>there are 3 counts</p>
</blockquote>

<p>I thought of converting them to a list and using len() but i do not know how</p>

<pre><code>#inputs
year = int(raw_input("Input year: "))
endyear = int(raw_input("Input end year:"))

print "The number of leap years are "

counter = 0
for x in range(year,endyear+1):

    if x % 4 == 0 and (x % 100 != 0 or x % 400 == 0):
        counter +=1
        print x
        print counter
</code></pre>

<blockquote>
  <p>heres the current result :(</p>
</blockquote>

<p>The number of leap years are </p>

<pre><code>1900
0
1901
0
1902
0
1903
0
</code></pre>

<p>you can do it in a shorter way:</p>

<pre><code>from calendar import isleap
years = [ str(x) for x in range(year,endyear+1) if isleap(x)]

print "the years are ", ''.join(elem + " " for elem in years)
print "there are ", len(years), "counts"
</code></pre>

python