(3)输入某年某月某日,判断这一天是这一年的第几天?

题目:

  输入某年某月某日,判断这一天是这一年的第几天?

 1 years = input("year:",)
 2 months = input("month:",)
 3 day = input("day:",)
 4 
 5 
 6 m = [31,28,31,30,31,30,31,31,30,31,30,31]
 7 if int(years)%4 == 0:
 8     m[1] = 29
 9 months_int = int(months)-1
10 a =0
11 for i in m[0:months_int]:
12     a += i
13 
14 print (a+int(day))

 

posted @ 2017-06-13 00:01  投以木瓜  阅读(102)  评论(0)    收藏  举报