Skip to content

Instantly share code, notes, and snippets.

@amanuel1995
Created March 14, 2019 01:50
Show Gist options
  • Save amanuel1995/53837f49bfa4af0a7950854cf86a108b to your computer and use it in GitHub Desktop.
Save amanuel1995/53837f49bfa4af0a7950854cf86a108b to your computer and use it in GitHub Desktop.
leap year
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