Python program that test if a year is a leap year
Posted by Samath
Last Updated: November 06, 2014

Write a python program that takes a year as a parameter and returns true if the year is a leap year, otherwise it returns false. The input to this function must be an integer.

Leap Year Definition:

In the Gregorian Calendar, leap years are evenly divisible by 4, with the exception of centurial years that are not evenly divisible by 400.

A leap year can be centurial or non centurial (e.g. 1600, 1996). Non centurial year must be divisible by 4 and not divisible by 100 (e.g. 1992, 2008). Centurial leap year must be divisible by 400 (e.g. 1600, 2000, 2400 are leap years and 1700, 1800, 1900, 2100 are not leap years).

(Remember, == is used to check equality and != is used to check for inequality)

Here is the Solution for the problem above: 

def leap_Year(year):
    if year % 4 == 0 and year %100 != 0 or year % 400 == 0:    
        return True
        return False