Skip to content

Instantly share code, notes, and snippets.

@a-yasui
Created August 9, 2012 09:18
Show Gist options
  • Save a-yasui/3302596 to your computer and use it in GitHub Desktop.
Save a-yasui/3302596 to your computer and use it in GitHub Desktop.
1900年から2010年までのうち、毎年の日数を出力するプログラム
#!/usr/bin/env python
def is_uru (year):
if year % 4 == 0:
if year % 400 == 0:
return True
elif year % 100 == 0:
return False
return True
return False
def out_year (year):
y = 365
if is_uru(year):
y += 1
print "%d is `%d'" % (year, y)
if __name__ == "__main__":
for y in range(1900, 2010):
out_year(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment