码迷,mamicode.com
首页 > 编程语言 > 详细

Python基础(4)输入判断某年的第几天

时间:2017-06-25 15:28:40      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:raw   inpu   bsp   print   输入   ==   某年   put   python基础   

#判断某年的第几天
days=[0,31,59,90,120,151,181,212,243,273,304,334]
year=int(raw_input(‘nian:\n‘))
month=int(raw_input(‘yue:\n‘))
day=int(raw_input(‘ri:\n‘))
if (year % 400 == 0) or (year % 4 == 0) and (year % 100 != 0):
    if month >=3:
       answer=days[month-1]+day+1
       print ‘第‘,answer,‘天‘
    else:
        answer=days[month-1]+day
        print ‘第‘,answer,‘天‘
                          
        
else:
    answer=days[month-1]+day
    print ‘第‘,answer,‘天‘
                         

Python基础(4)输入判断某年的第几天

标签:raw   inpu   bsp   print   输入   ==   某年   put   python基础   

原文地址:http://www.cnblogs.com/jietingting/p/7076847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!