Thursday, November 8

Python program to Check if a Year is a leap Year.

A leap year is divisible by 4, but not by 100, unless it is also divisible by 400.

def LeapYear(yr):
if(yr % 4 == 0 and yr % 100 != 0 or yr % 400 == 0):
return True
else:
return False

>>> LeapYear(2012)
True>>> LeapYear(2010)
False 


Be the first one to Comment!!!

Post a Comment