Python Program to Check Leap Year

Here you will get python program to check leap year.

A normal year contains 365 days while a leap year contains 366 days.

If the year is divisible by 4 then it is leap year except the century years (year that have 00 in end). A century year is leap year only if it is not divisible by 100 but divisible by 400.

For example 2000, 2016 are leap year while 2002, 2017 are not leap year.

Below program ask user to input a year and then check it is leap year or not.

Python Program to Check Leap Year

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: 2016
leap year

Comment below if you have any queries related to above leap year program in python.

6 thoughts on “Python Program to Check Leap Year”

  1. surojit mondal

    #leap year
    y=int(input(“Enter the year “))
    if(y%4==0) and ((y%100!=0) or( y%400==0))):
    print(” Entered year is a leap year “)
    else:
    print(“Entered year is not leap year”)

Leave a Comment

Your email address will not be published. Required fields are marked *