Skip to content

Instantly share code, notes, and snippets.

@touyou
Created November 22, 2010 14:19
Show Gist options
  • Save touyou/710030 to your computer and use it in GitHub Desktop.
Save touyou/710030 to your computer and use it in GitHub Desktop.
python
#! /usr/bin/env python
def main():
while True:
year = input("年を入力:")
if year % 4 == 0 and not year % 100 == 0 or year % 400 == 0:
print year,"年は閏年です。"
else if year == none:
break
else:
print year,"年閏年ではありません。"
if __name__ == "__main__": main()
@Cam1337
Copy link

Cam1337 commented Mar 6, 2011

When you call input() it automatically evaluates the code (a security flaw). Instead, use raw_input("年を入力: ") and convert it to an integer using int()

@yusufshehu
Copy link

it awesome and work nicely,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment