Like Us Like Us Facebook Subscribe Subscribe us YouTube Whatsapp Share us Whatsapp Query Send your queries

Python Program to Check Leap Year

Python Program to Check Leap Year

In this tutorial we learn how to check leap year using Python 3.X program.  Leap years are years where an extra day is added to the end of the shortest month (February). This additional day is added in February which makes it 29 days long.
Leap years have 366 days instead of the usual 365 days and occur almost every four years.

#function checkLeap will leap year
def checkLeap(Year):   
  if((Year % 400 == 0) or  
     (Year % 100 != 0) and  
     (Year % 4 == 0)):   
    print("Leap Year");   
    print ("Not a leap Year")  
# Taking an input year from user  
yr= int(input("Enter the Year: "))  
#Printing result  

Save above code as Open CMD or Terminal and run command given below

For Windows :  python ./

For Linux : python3 ./

Python leap year

5 3 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments