def date_to_week(year,month,day):
run_year=[31,28,31,30,31,30,31,31,30,31,30,31]
ping_year=[31,28,31,30,31,30,31,31,30,31,30,31]
year_day=0
for i in range(1990,year):
if i%4000 or (i%40 and i%1000):
year_day+=366
else:
year_day+=365
print(year_day)
if year%400 == 0 or (year%40 and year%100==0):
m_day=sum(run_year[0:month-1])
else:
m_day=sum(ping_year[0:month-1])
print(m_day)
day1=year_day+m_day+day
print(day1)
list5=[‘星期日’,‘星期一’,‘星期二’,‘星期三’,‘星期四’,‘星期五’,‘星期六’]
j=day1%7
print(list5[j])
c=date_to_week(2020,11,1)
print©
1990年1月1日是星期一,定义函数date_to_week(year,month,day),实现功能输入年月日后返回星期几,例如date_to_week(2020,11,1),返回:星期日。 提示:
最新推荐文章于 2022-10-28 15:09:34 发布