题解 | #计算日期到天数转换#
计算日期到天数转换
http://www.nowcoder.com/practice/769d45d455fe40b385ba32f97e7bcded
year, month, day = map(int, input().split()) feb = 29 if (year % 4 == 0 and year % 100 != 0) or year % 400 ==0 else 28 thirty_one = [1, 3, 5, 7, 8, 10, 12] calc = 0 for i in range(1, month): if i in thirty_one: calc += 31 elif i == 2: calc += feb else: calc+=30 calc+=day print(calc)