# Python Program to Check Leap Year

In this example, we will write a simple program to take input year from the user and display if it is either a leap year or not. To better understand this example, make sure you have knowledge of the following tutorials:-

A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.

## Python Program to Check Leap Year is if…else statement:

year = int(input("Enter the year to be checked: "))
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print("The year is a leap year!")
else:
print("The year isn't a leap year!")

The output of the above program is:-

Enter the year to be checked: 2019
The year isn’t a leap year!

## Python Program to Check Leap Year is nested if…else statement:

year = int(input("Enter the year to be checked: "))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("The year is a leap year!")
else:
print("The year is a not leap year!")
else:
print("The year is a leap year!")
else:
print("The year is not a leap year!")

The output of the above program is:-

Enter the year to be checked: 2018
The year is not a leap year!