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
|
2948 Discussions
|
Please Login in order to post a comment
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))
year=int(input()) if year%4 == 0 or year%400 == 0: print('True') elif year%100 != 0: print('False')
Simple step by step
Simple step by step
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)