Skip to content

Instantly share code, notes, and snippets.

@ejmurray
Created July 24, 2015 15:01
Show Gist options
  • Save ejmurray/bc0c39de4fc1b7c04381 to your computer and use it in GitHub Desktop.
Save ejmurray/bc0c39de4fc1b7c04381 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
__author__ = 'Ernest'
def is_leap_year(x):
if x % 4 == 0 and x % 100 != 0:
print "%r was a leap year" % x
elif x % 400 == 0:
print "%r was a leap year" % x
else:
print "%r was not a leap year" % x
is_leap_year(2000)
is_leap_year(0)
is_leap_year(1996)
is_leap_year(1993)
is_leap_year(1972)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment