We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
One of the test cases is wrong, resulting in error of submission of code. If you want to just let it pass use:
if year%400==0: leap = True elif year%100==0: leap = False elif year%4==0: leap = True else: leap = False
But the original solution to the problem is:
def is_leap(year):
if year%400 == 0 and year%100 ==0 and year%4==0:
return True
else:
return False
year = int(input())
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Write a function
You are viewing a single comment's thread. Return to all comments →
One of the test cases is wrong, resulting in error of submission of code. If you want to just let it pass use: if year%400==0: leap = True elif year%100==0: leap = False elif year%4==0: leap = True else: leap = False
But the original solution to the problem is: def is_leap(year): if year%400 == 0 and year%100 ==0 and year%4==0: return True else: return False year = int(input())