# Python Program to Check Leap Year

A leap year is a calendar year in which an additional day is added to February month. In a leap year, the number of days in February month and the year are 29 and 366 respectively. A year that is not a leap year is called a common year. A year is said to be a leap year if:

- it is divisible by 4.
- it is divisible by 4 but not divisible by 100.
- it is divisible by 4, 100 and 400.

### Method 1: Using conditional statements

In the below example, conditional statements are used to identify a leap year.

year = 2019 if year % 400 == 0: print(year, "is a leap year.") elif year % 100 == 0: print(year, "is not a leap year.") elif year % 4 == 0: print(year, "is a leap year.") else: print(year, "is not a leap year.")

The above code will give the following output:

2019 is not a leap year.

### Method 2: Using function

In the below example, a function called *leapyear()* is created which takes *year* as argument and prints whether the passed *year* is a leap year or not.

def leapyear(year): if year % 400 == 0: print(year, "is a leap year.") elif year % 100 == 0: print(year, "is not a leap year.") elif year % 4 == 0: print(year, "is a leap year.") else: print(year, "is not a leap year.") leapyear(2019)

The above code will give the following output:

2019 is not a leap year.

### Recommended Pages

- Python - Swap two numbers
- Python Program - Fibonacci Sequence
- Python Program - Insertion Sort
- Python Program - Find Factorial of a Number
- Python Program - Find HCF of Two Numbers
- Python Program - Merge Sort
- Python Program - Shell Sort
- Stack in Python
- Queue in Python
- Python Program - Find LCM of Two Numbers
- Python Program - To Check Whether a Number is Palindrome or Not
- Python Program - To Check Whether a String is Palindrome or Not
- Python Program - Heap Sort
- Python Program - Quick Sort
- Python - Swap Two Numbers without using Temporary Variable
- Python Program - To Check Armstrong Number
- Python Program - Counting Sort
- Python Program - Radix Sort
- Python Program - Find Largest Number among Three Numbers
- Python Program - Print Floyd's Triangle