"""
闰年:
能被4整除,并且不能被100整除
或者
能被4整除,并且又能被400整除
"""
while 1:
this_time = int(input("请输入年份:"))
#条件1
condition1 = this_time%4 == 0 and this_time%100 != 0
#条件2
condition2 = this_time%4 == 0 and this_time%400 == 0
if (condition1 or condition2):
print("%d年是闰年"%(this_time))
else:
print("%d年不是闰年"%(this_time))
python简单判断输入年份是否为闰年
作者:
在
发表回复