Advertisement
AyanUpadhaya

Leap year calculation problem solving | HackerRank

Oct 26th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. """
  2. Task
  3.  
  4. Given a year, determine whether it is a leap year. If it is a leap year, return the Boolean True, otherwise, return False.
  5. """
  6.  
  7. #Code:
  8.  
  9. def is_leap(year):
  10.     leap = False
  11.    
  12.     # Write your logic here
  13.     if ((year % 400 == 0) or (year % 4 == 0) and (year % 100 !=0)):
  14.         leap = True
  15.    
  16.     return leap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement