Created
November 22, 2010 14:19
-
-
Save touyou/710030 to your computer and use it in GitHub Desktop.
python
This file contains 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
#! /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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you call input() it automatically evaluates the code (a security flaw). Instead, use raw_input("年を入力: ") and convert it to an integer using int()