year = int(input("请输入某年"))
month = int(input("请输入某月"))
day = int(input("请输入某日"))
s = 0
daylist = [0,31,60,91,121,152,182,213,244,274,305,335,366]
if month == 1:
if day < 32:
s = day
else:
s = "NaN"
print("请输入正确的天数")
else:
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
if 1 < month < 3:
if day < 30:
s = int(daylist[month - 1]) + day
else:
s = "NaN"
print("请输入正确的天数")
elif 1 < month < 13:
s = int(daylist[month - 1]) + day
else:
s = "NaN"
print("请输入正确的月份")
else:
if 1 < month < 3:
if day < 29:
s = int(daylist[month-1])+day
else:
s = "NaN"
print("请输入正确的天数")
elif 2 < month < 13:
s = int(daylist[month - 1]) + day -1
else:
s = "NaN"
print("请输入正确的月份")
print("%d年%d月%d日 是%d年的第%d天" % (year, month, day, year, s))
© 版权声明
原创文章未经允许请勿转载。
THE END
请登录后查看评论内容