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
|
2681 Discussions
|
Please Login in order to post a comment
def is_leap(year): leap = False
# Write your logic here
leap = (year % 4 ==0 and (year %100 !=0 or year % 400 == 0)) return leap
year = int(input()) print(is_leap(year))
def is_leap(year): leap = False
year = int(input()) print(is_leap(year))
Works like a charm
def is_leap(year): leap = False if (year%4 == 0 and year%100 != 0) or (year%400 == 0): return True else: return leap year = int(input()) print(is_leap(year))
if 1900<=year<=10**5: if (year%4==0 and (year%100==0 and year%400==0)):
I wrote this code but test case 5 is wrong ,can any one help
def is_leap(year): if (year % 4==0 and year % 100!=0 )or year % 400==0: return True else: return False
year = int(input())