Wednesday, June 26, 2019

Python Program | Check Whether a Given Year is a Leap Year

Problem Description

The program takes in a year as input and checks whether it is a leap year or not.

Program/Source Code

Source code of the Python Program to find if the year entered is a leap year or not. 
Year=int(input("Enter year to be checked:"))
if(Year%4==0 and Year%100!=0 or Year%400==0):
    print("The year is a leap year!)
    print("The year isn't a leap year!)
The program output is also shown below.

Runtime Test Cases

Test 1:
Enter year to be checked:2005
The year isn't a leap year!

Test 2:
Enter year to be checked:2016
The year is a leap year!
If You Enjoyed This, Take 5 Seconds To Share It