题目:输入某年某月某日,判断这一天是这一年的第几天?
from datetime import date
year=int(input("Enter a year: "))
month=int(input("Enter a month: "))
day=int(input("Enter a day: "))
sunmonth=(0,31,59,90,120,151,181,212,243,273,304,334)
if month<=12 and month>=0:
sum=sunmonth[month-1]
else:
print("data error")
if day<=31 and day>0:
sum=sum+day
leap=0
if year%4==0 and year%100!=0:
leap=1
sum=sum+leap
print(sum)