ITPub博客

首页 > Linux操作系统 > Linux操作系统 > python学习-判断闰年脚本

python学习-判断闰年脚本

原创 Linux操作系统 作者:fei890910 时间:2016-06-29 21:15:32 0 删除 编辑
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 + ' 不是闰年啊')
    

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29108064/viewspace-2121220/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: pg 常用
下一篇: 网络配置yum源
请登录后发表评论 登录
全部评论

注册时间:2013-08-15

  • 博文量
    122
  • 访问量
    811203