Python Program to Check whether Year is a Leap Year or not


In this tutorial, we are going to write a Python program to check whether the input year is leap year or not.


Python Program to Check whether Year is a Leap Year or not

# Getting input from user
Check_year = int(input("please Enter the Year: "))

# Check input year is Leap Year or not
if Check_year % 4 == 0 and Check_year % 100 != 0:
   print("%d year is a Leap Year" %Check_year)
elif Check_year % 100 == 0:
    print("%d year is Not the Leap Year" %Check_year)
elif Check_year % 400 ==0:
    print("%d year is a Leap Year" %Check_year)
else:
    print("%d year is Not the Leap Year" %Check_year)

Output:-

please Enter the Year: 1988
1988 year is a Leap Year

 


 

Leave a Reply

Your email address will not be published. Required fields are marked *