write a function in python
#write a function in hacker rank solutions
def is_leap(year):
leap = False
# Write your logic here
if(year%400==0 or year%4==0 and year%100!=0):
leap=True
return leap
year = int(input())
print(is_leap(year))
Another logic
def is_leap(year):
leap = False
if(year%4==0):
if(year%100==0):
if(year%400==0):
leap=True
else:
leap=False
else:
leap=True
else:
leap=False
# Write your logic here
return leap
year = int(input())
print(is_leap(year))
Comments
Post a Comment