Friday, May 3, 2019

Leap Year Conditions in python, Check Whether a Given Number is a Loop Year

PYTHON

Python Program To Check Whether The Given Year is a Loop Year or Not a Leap Year.

Source Code


def leapyear(y):
    if y % 400 == 0:
        return "Leap Year"
    elif y % 100 == 0:
        return "Not a Leap Year"
    elif y % 4 == 0:
        return "Leap Year"
    elif y <= 1000:
        print("Invalid Year, Please input a valid year")
    else:
        return "Not a Leap Year"
    # Write your logic here
while True:
    print(leapyear(int(input("Enter Year To be Checked: "))))

Hope The Code Worked and This "Leap Year Conditions in python" Article Was Helpful, Please Don't Forget To Share This Article With Your Friends.

No comments:

Post a Comment

close