Python Program to check leap year or not

Leap year or not in Python

In this tutorial, we are going to learn How to check leap year or not in Python. Before we get into leap year program, Let us see the logic and definition behind the leap year.

Generally, a normal year contains 365 days but leap year contains 366 days. That particular one day is added to the month of February. So in a leap year in the month of February, we have 29 days.

You may also read:

Check if a year is a leap year or not in Python

How to check leap year?

  1. All the years that are perfectly divisible by 4 are called Leap years except the century years.
  2. If the century year is divisible by 400 then that year is a Leap year otherwise not.
year=int(input("Enter year to be check: "))
if(year%4==0 and year%100!=0 or year%400==0):
    print(year," is a leap year")
else:
    print(year," is not a leap year")

Output:

Enter year to be check: 2000

2000 is a leap year
Enter year to be check: 1900

1900 is not a leap year

So Guy’s, I hope this tutorial was helpful to you and feel free to leave a comment if you have any doubt.

You may also learn:

Leave a Reply

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