Check Leap Year

Check Leap Year using Python Programming

Check Leap Year using Python Programming

Hello coders, welcome to the codewithrandom blog. In this article, we create a python program to check leap Year  using Python Programming with Complete Source Code.

 

Check Leap Year using Python Programming

What is Check Leap Year program?

A leap year is a year that has an extra day added to it, making it 366 days instead of the usual 365 days. To be more precise, a year is a leap year if it is evenly divisible by 4, except for years that are divisible by 100. However, years that are divisible by 400 are still leap years. This means that the year 2000 was a leap year because it is divisible by 400, but the year 1900 was not a leap year because although it is divisible by 4, it is also divisible by 100 and not by 400.

How To Run The Code :

step 1: open any python code Editor.

step 2 : Copy the code for the Check Leap Year in Python, which I provided Below in this article, and save it in a file named “main.py” (or any other name you prefer).

step 3:  Run this  python file  main.py to start the .

That’s it! Have Check Leap Year using Python Programming .

complete code 👇👇

 # Here, you take the input from the user

year = int(input("Enter a year:- "))  

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

    """
    if a year is a multiple of four and a multiple of 100 i.e. if it is a multiple of 400 it is not a leap year
    """

    print("{0} is a leap year!!".format(year))

    """
    printing the output
    """
else:
    print("{0} is not a leap year!!".format(year))

output👇👇

Enter a year:- 2023
2023 is not a leap year!!

 

Conclusion

In this blog post, we’ve shown you how to create an Leap Year Checker program using Python. Hope you enjoyed building with us! Visit our homepage and you get lot’s of projects💝.

Converting numbers to words in Python

Create a Random Password Generator in Python

How to Take a Screenshot using Python



Leave a Reply