def isLeap(year):
return (year % 400 == 0) or (year %4 == 0 and year % 100 != 0)
def countDay(year,month,date):
list = [31,28,31,30,31,30,31,31,30,31,30,31]
if isLeap(year):
list[1] = 29
tatal = date
for i in range(0,month-1):
tatal += list[i]
return tatal
year = int(input("请输入年份:"))
month = int(input("请输入月份:"))
date = int(input("请输入日期:"))
print(countDay(year,month,date))
python输入年月日输出到今天过了几天
最新推荐文章于 2024-04-12 09:49:16 发布