判断一个年份是闰年

temp = input("请输入一个年份:")
while not temp.isdigit():
    print("您的输入不合法")
    temp = input("请输入一个年份:")
year = int(temp)
if (year %4==0 and year %100 !=0) or year%400 ==0:
    print("您输入的年份是闰年")
else:
    print("您输入的年份不是闰年")

  

posted @ 2018-03-22 16:12  散步去看雨  阅读(124)  评论(0)    收藏  举报