DEV Community

Cover image for Leap Year Calculator
Scott Gordon
Scott Gordon

Posted on

Leap Year Calculator

# leap_year_calc.py
#   This program calculates whether a year is leap year.
# by: Scott Gordon

def main():
    print("***** Welcome to The Leap Year Calculator *****\n")
    print("Enter a year in the (xxxx) format to check if it is a leap year.")
    year = int(input("Enter the year here: "))

    def check_leap(year):
        if((year % 400 == 0) or (year % 100 != 0) and (year % 4 == 0)):
            return True
        else:
            return False

    print(check_leap(year))


if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

Photo by Kid Circus on Unsplash

Top comments (0)