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
Sort by
recency
|
2824 Discussions
|
Please Login in order to post a comment
its showing that 2100 is false though 2100 is not leap year
if year % 400 == 0: leap = True elif year % 100 == 0: leap = False elif year % 4 == 0: leap = True
def is_leap(year): leap = False if (year%4==0 & year%100==0) | year%400==0: leap = True # Write your logic here
year = int(input())
its giving test case error pls give me full solution
def is_leap(year): leap = False if(year%100==0): if(year%400==0): leap = True elif(year%4==0): leap = True else: leap = False return leap
year = int(input()) print(is_leap(year