Task
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.
Input Format
Read year,
the year to test.
Constraints
1900<=year <=10^5
Output Format
The function must return a Boolean value (True/False). Output is
handled by the provided code stub.
Sample Input 0
1990
Sample Output 0
False
Explanation 0
1990 is not a multiple of 4 hence it's not a leap year.
Code:
def is_leap(year):
leapyear = False
if year % 400 == 0:
leapyear = True
elif year % 100 == 0:
leapyear = False
elif year % 4 == 0:
leapyear = True
return leapyear
year = int(raw_input())
print is_leap(year)
Price drop alert
Redmi 9 Prime :
Rating - 4.0 to 4.3 and 14,000+ reviews
Price - 9000₹ to 11000₹
for latest information click - https://amzn.to/3bsDxWY
No comments: