temp = input('请输入一个年份:')
while not temp.isdigit():
temp = input('抱歉输入有误,请从新输入:')
year = int(temp)
if year%400 == 0:
print(temp + ' 是闰年啊')
else:
if (year/4 == int(year/4) and (year/100 != int(year/100))):
print(temp + ' 是闰年啊')
else:
print(temp + ' 不是闰年啊')
while not temp.isdigit():
temp = input('抱歉输入有误,请从新输入:')
year = int(temp)
if year%400 == 0:
print(temp + ' 是闰年啊')
else:
if (year/4 == int(year/4) and (year/100 != int(year/100))):
print(temp + ' 是闰年啊')
else:
print(temp + ' 不是闰年啊')
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29108064/viewspace-2121220/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29108064/viewspace-2121220/