|
发表于 2020-2-24 23:13:41
|
显示全部楼层
number=[0,31,28,31,30,31,30,31,31,30,31,30,31]
temp=input('请输入日期(格式如:2000.02.08):')
temp=list(temp)
temp.reverse()
year=''
month=''
day=''
while temp[-1]!='.':
year+=str(temp.pop())
temp.pop()
while temp[-1]!='.':
month+=str(temp.pop())
temp.pop()
month=int(month)
print(month)
while temp:
day+=str(temp.pop())
year=int(year)
month=int(month)
day=int(day)
if (year%100==0)and(year%100==0):
flag=1
elif (year%4==0)and(year%100!=0):
flag=1
else :
flag=0
i=range(month)
if month<=2:
num=0
for each in i:
num+=number[each]
num+=day
elif (2<month<=12):
num=flag
for each in i:
num+=number[each]
num+=day
print("%d月%d日是%d年的第%d天"%(month,day,year,num)) |
|