year=int(input('请输入年:'))
month=int(input('请输入月:'))
day=int(input('请输入日:'))
run_month=[1,3,5,7,8,10,12]#闰月有这几个
num=0
if (year % 400 == 0) or ((year % 4 == 0) and (year % 100 != 0)):
feb = 29 #闰年2月是29天
else:
feb = 28
for mth in range(1,month):
if mth in run_month: #判断mth是否是闰月
y = 31
elif mth==2:
y=0
else:
y = 30
num+=y
mth=mth-1
num_all=num+feb+day
print('这一天是%d年的第%d天!'%(year,num_all))
运行结果