Day1:输入年月日,判断这一天是这一年的第几天
eg: input : 2019-02-01
output : 32
1 data = list(input('please input year,month,day:').split('-')) 2 data = [int(x) for x in data] 3 Month = [31,28,31,30,31,30,31,31,30,31,30,31] 4 i = 0 5 total = data[2] 6 while i < data[1] - 1: 7 total += Month[i] 8 i += 1 9 if data[0] % 400 == 0 or (data[0] % 4 == 0 and data[0] % 400 != 0): 10 if data[1] > 2: 11 total += 1 12 print('it is the %dth day in the {} year.'.format(data[0])%total)