Python Program to Check The Leap Year

Here you may get a python program to examine intercalary year.

A normal year contains three hundred and sixty-five days whereas an intercalary year contains three hundred and sixty-six days.

If the year is partible by four then it’s intercalary year except for the century years (the year that has 00 in end). A century year is an intercalary year as long as it’s not partible by a hundred however divisible by four hundred.

For example 2000, 2016 are intercalary year whereas 2002, 2017 don’t seem to be the intercalary year.

Below program raises the user to input a year and so check it’s an intercalary year or not.

Python Code to Check The Leap Year

Code

year = int(input("enter a year: "))
 
if(year%4==0 and (year%100!=0 or year%400==0)):
	print("leap year")
else:
	print("not leap year")

Output

enter a year: 2020
leap year

Comment below if you have got any queries associated with on top of intercalary year program in python.

Leave a Comment

error: Alert: Content is protected!!