In this Python tutorial, you will learn how to write a python program to check a leap year. Here in this article we have provided a python source code which output if the user entered year is a leap year or not.

**Prerequisite topics to create this program**

**Steps**

- First, we ask the user to enter the 4 digit year.
- Using the int() function we will convert the entered string into an integer value.
- Using the if….elif nested statement and arithmetic modules operator we check for conditions.

#### Python Program to Check Leap Year:

**Code:**

year = int(input("Enter the Year: ")) if year%4==0: if year%100==0: if year%400==0: print(year, "is a leap year") else: print(year, "is a not leap year") else: print(year, "is a leap year") else: print(year, "is a not leap year")

**Output 1:**

Enter the Year: 2020 2020 is a leap year

**Output 2:**

Enter the Year: 2019 2019 is a not leap year

**Conclusion**

Here in this tutorial, you learned how to write a python program to check if the user entered Year is a leap year or not. In the first check, we check if the year is divisible by 4. If the Year is divisible by 4 and not divisible by 100 then it is a leap year. If a Year is divisible by 4 and 100, it has to be divisible by 400 to be a leap year.

**People are also reading:**

- Python Program to Sort Words in Alphabetic Order
- Python Program to Merge Mails
- WAP to Find Cube of a Number using Functions
- Python Program to find Hash of File
- WAP to find quotient and remainder of two numbers
- Python Program to Print all Prime Numbers in an Interval
- WAP to create a loading bar
- Python Program to Display the Multiplication Table
- WAP to calculate sum and average of three numbers
- Python Program to Find the Factors of Number