判断给定年份是否为闰年

tmp=input('Enter the year:')
while not tmp.isdigit() :
    tmp=input('Enter a \'number\' again:')
year=int(tmp)
a=year/4
b=year/100
c=year/400
d=int(c)
e=int(a)
f=int(b)
if d==c:
    print(year,'YES')
else:
    if a==e and f!=b:
        print(year,'YES')
    else:
        print(year,'NO')
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注