We add a Leap Day on February 29, almost every four years. The leap day is an ex
ID: 3744445 • Letter: W
Question
We add a Leap Day on February 29, almost every four years. The leap day is an extra day and we add it to the shortest month of the year, February. There are three criteria to identify leap years: The year can be evenly divided by 4, is a leap year, unless: The year can be evenly divided by 100, it is NOT a leap year, unless: The year is also evenly divisible by 400. Then it is a leap year. This means that in the Gregorian calendar, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years. 2. Your task is to write a program to input an integer variable. Write a function to verify whether the integer is a leap year or not. The function should return True/False. Example: Input: 1988 Output: False Input: 1992 Output: TrueExplanation / Answer
def isLeap(year): if year % 4 == 0: if year % 100 == 0: return year % 400 == 0 return True return False print(isLeap(int(input())))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.