Computer Science, asked by beautyfool40, 5 months ago

Find all leap years from 2000 to 2050 using python

Answers

Answered by nasaanirudh
1

Answer:

Input = [2001, 2002, 2003, 2004, 2005, 2006,  

        2007, 2008, 2009, 2010, 2011, 2012]

def checkYear(year):  

   return (((year % 4 == 0) and

            (year % 100 != 0)) or

            (year % 400 == 0))

Answer = 0  

for elem in Input:  

   if checkYear(elem):  

       Answer = Answer + 1

print("No of leap years are:", Answer)

Explanation:

Similar questions