Created
March 14, 2019 01:50
-
-
Save amanuel1995/53837f49bfa4af0a7950854cf86a108b to your computer and use it in GitHub Desktop.
leap year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_leap(year): | |
leap = False | |
# Write your logic here | |
# The year can be evenly divided by 4, is a leap year, unless: | |
# The year can be evenly divided by 100, it is NOT a leap year, unless: | |
# The year is also evenly divisible by 400. Then it is a leap year. | |
if year < 100000 and year > 1900: | |
if year % 4 == 0: | |
leap = True | |
if year % 100 == 0: | |
leap = False | |
if year % 400 == 0: | |
leap = True | |
return leap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment