Updated: Mar 12
Python program to check a year is leap or not | Python programming | Ask The Code
Given a year, determine whether it is a leap year. If it is a leap year, return the Boolean True, otherwise return False. Note that the code stub provided reads from STDIN and passes arguments to the is leap function. It is only necessary to complete the is leap function.
Read year, the year to test.
The function must return a Boolean value (True/False). Output is handled by the provided code stub.
def is_leap(year): leap = False if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: leap = True return leap year = int(input()) print(is_leap(year))