Python Program to Check Leap Year

Python Program to see Leap-year

A Leap-year  is strictly divisible by 4 apart from century years (years ending with 00). The century year may be a Leap-year as long as it’s perfectly divisible by 400. for instance ,2017 isn’t a Leap-year 1900 may be a not Leap-year2012 may be a Leap-year 2000 may be a Leap-year
CODE OUTPUT
# Python program to check if the input year is a leap year or not

 

year = 2000

 

# To get year (integer input) from the user

# year = int(input(“Enter a year: “))

 

if (year % 4) == 0:

if (year % 100) == 0:

if (year % 400) == 0:

print(“{0} is a leap year”.format(year))

else:

print(“{0} is not a leap year”.format(year))

else:

print(“{0} is a leap year”.format(year))

else:

print(“{0} is not a leap year”.format(year))

 

2000 is a leap year

 

You can change the value of year in the code and run it again to test this program.

Questions