Simple Python Program to Check Leap Year | Python Program to Check Leap Year - Codexashish

Simple Python Program to Check Leap Year

In this blog, we are going to see a year is a leap year or not in python programming. Python Program to Check Leap Year.

Python Program to Check Leap Year

    What is a Leap Year?

    As we know, a normal year has 365 days total. but in a leap year, there have 366 days(the extra day is the 29th of February).

    Ex:- 2000, 2004, 2008, 2012, 2016, 2020, 2024, etc.

    Key Points:-

    • Leap Years are any year that can be exactly divided by 4, but not by 100 such as:-2016, 2024, etc).
    • And Also any year that can be exactly divided by 400 and 100, then it is such as- 2000, 2400).

    Keep in mind:- Remainder should be zero.

    code:-

    // input_year is a input that will be taken by user.

    input_year=int(input("Enter year to be checked : ")) 

    if input_year%4==0 and input_year%100!=0 or input_year%400==0):

    print("The year is a Leap Year")

    else:

    print("The year is not a Leap Year")

    Output:-

    Enter year to be checked : 2012

    The year is a Leap Year

    Click Here to Download This Code.

    Conclusion:

    Do you have any queries related to This Article, Please mention them in the Comment Section of this Article, We will contact you soon.

    Thank you for reading this blog. I wish you the best in your journey to learning and mastering Python.

    Follow me to receive more useful content:

    Instagram | Twitter | Linkedin | Youtube

    Thank you

    People are also reading:-

    Ashish Yadav

    Hi, I am Ashish Yadav, The founder of the codexashish.com website. I am a Data Analyst by profession and a Blogger, and YouTuber by choice and I love sharing my knowledge with needy people like You. I love coding and blogging.

    Post a Comment (0)
    Previous Post Next Post