Python Example Program to Check Leap Year or Not

Learn to write a Simple Python Program to check whether a year is a Leap Year or not

In this program we ask the user to enter the year then we check it for leap year and then we display the result.

Source Code to Check for Leap year wihout using Calendar Module : Leap Year.py

 1 year = int(input("Enter the Year to Check for Leap Year : "))
 2 
 3 if (( year % 4 ) == 0):
 4         if(( year % 100 ) == 0):
 5                 if( ( year % 400 ) == 0):
 6                         print("{0} is a Leap Year".format(year))   
 7                 else:
 8                         print("{0} is not a Leap Year".format(year))
 9         else:
10            print("{0} is a Leap Year".format(year))             
11 
12 else:
13         print("{0} is not a Leap Year ".format(year))

Watch this video to learn how this works