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>The problem was when needed year occur, the <code>break</code> stopped your loop.</p>

<pre><code>year = int(raw_input("Input year: "))
end_year = int(raw_input("Input end year:"))

print "The number of leap years are "

counter = 0
temp = []
for x in range(year, end_year+1):
    if x % 4 == 0 and (x % 100 != 0 or x % 400 == 0):
           counter +=1
           temp.append(x)
print('the years are {}'.format(temp))
print('there are {} counts'.format(counter))
</code></pre>

<p>You also might want to remove brackets in <em>"the years are []"</em>, you can do that with </p>

<pre><code>print('the years are ', ' '.join(map(str, temp)))
</code></pre>

python