# Python Program to Check a Year is Leap Year or Not

Hey Shouters!! Today we have come up with the Python program to check leap year.

Leap year program is a very important program for the placement point of view and from exams point of the year.

## What is a Leap Year?

Leap year is a year in which there is an extra one day in the year.

In a normal year, the number of days is 365 but in a leap year we have 366 days and that is because of the distance between the earth and sun.

Leap year comes after every four years in the year count.

## Logic to Check Leap Year-

In programming, it is very important to have a mathematics logic for solving the problem.

In Leap year program, we also have the logic. The logic to check a leap year is:

**Condition 1: **If a year is divisible by 4 and is not divisible by 100. It is called a leap year.

For example 1. 1800 is divisible by 4 but is also divisible by 100. So, 1800 is not a leap year.

**Condition 2:** If year is divisible by 400, year is also a leap year.

For Example, Consider 2000, the year is not able to fulfill the condition 1 but is divisible by 400, it will also be a leap year.

## 1. Python Program To Check leap year using If-else:

In this program, we will use Conditions statements like if-else and will find out the leap year or not.

In this method, we first check the first condition and then used the second condition using if-else and then got the result.

1 2 3 4 5 6 7 8 9 10 |
#Python Program To check Leap Year print("Enter the year you want to check") year=int(input()) if year%4==0 and year %100!=0: print("The year is a leap year",year) elif year%400==0: print("The year is a leap year",year) else: print("The year is not a leap year ",year) |

1 2 3 4 |
Output - Enter the year you want to check 1700 The year is not a leap year |

## 2. Python Program to Check Leap Year using Functions-

In this method, we will use a function Leap_Year() and will check the leap year.

1 2 3 4 5 6 7 8 9 10 11 12 |
#Python Program To check Leap Year def Leap_Year(year): if year%4==0 and year %100!=0: print("The year is a leap year ",year) elif year%400==0: print("The year is a leap year ",year) else: print("The year is not a leap year",year) print("Enter the year you want to check") year=int(input()) Leap_Year(year) |

1 2 3 4 |
Output - Enter the year you want to check 200 The year is a leap year 2000 |

If you want to prepare for placement mock tests, then follow us on Instagram, we daily add Multiple Choice Questions to clear concepts. Shout Coders