I have been working on this program, any kind of help will be appreciated.
program to find the leap years between two years and add them to array...
from array import array
x=int(input("Enter the year "))
print("the year you entered is",x)
while x<=2017:
if x%4==0:
print(x)
n=array('i',[x])
n.append(x)
x=x+1
else:
x=x+1
print(n)
Output
enter the year 1992
the year you entered is 1992
1992
1996
2000
2004
2008
2012
2016
array('i', [2016, 2016])
array.arrayfor this instead of a plainlist?list(range(-n//4*-4,2018,4)), but as Vasyl Moskalov mentions this logic doesn't handle century years like 1900 correctly.[i for i in range(-n//4 * -4, 2020, 4) if i%100 or i%400 == 0]