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.
- Prepare
- Python
- Introduction
- Write a function
- Discussions
Write a function
Write a function
+ 0 comments def is_leap(year):
# Write your logic here if (year%4 == 0): if (year % 100 == 0): if (year% 400 == 0): return True return False return True return False
year = int(input()) print(is_leap(year))
+ 1 comment if(year % 4 == 0 and year % 400 == 0 and year % 100 != 0): print(True) else: return leap
Hello Guys, my this code passes the 3 test cases, can anyone tell me how to solve the all cases?
+ 0 comments if year % 100 == 0: if year % 400 != 0: return False else: return True elif year % 4 == 0: return True else: return False
+ 0 comments if year % 100 == 0: if year % 400 != 0: return False else: return True elif year % 4 == 0: return True else: return False
+ 0 comments def is_leap(year): leap = False
if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: leap = True else: leap = True return leap
year = int(input()) print(is_leap(year))
Load more conversations
Sort 2211 Discussions, By:
Please Login in order to post a comment