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 Easy to understand:
def is_leap(year): leap = False if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): leap = True return leap
+ 0 comments from calendar import isleap
def is_leap(year): leap = False
# Write your logic here #it is wrong in one case not successful # if year % 4==0: # leap = True # elif year % 100==0: # leap # elif year % 400==0: # leap = True #leap = isleap(year) only muggle use this #logic batman know! if (year % 4==0) and (year % 100!=0): leap=True elif (year % 100==0) and (year % 400!=0): leap = False elif (year % 400==0): leap = True else: leap return leap
year = int(input()) print(is_leap(year))
+ 0 comments def is_leap(year): leap = False
# Write your logic here if (year % 400 == 0 ): leap = True elif (year % 100 == 0): leap = False elif (year % 4 == 0): leap = True return leap # return leap
year = int(input()) print(is_leap(year))
+ 1 comment def is_leap(year): leap = False
# Write your logic here if year % 4 == 0: return True else: return False if year % 100 != 0: return True else: return False if year % 400 == 0: return True else: return Falsewhy i can't do
+ 0 comments def is_leap(year): leap = False
# Write your logic here if (year %100 == 0 and year % 400 !=0) or year % 4 !=0: return leap else : leap = True return leap
year = int(input()) print(is_leap(year))
Load more conversations
Sort 2436 Discussions, By:
Please Login in order to post a comment