当前位置:网站首页>1990年1月1日是星期一,定义函数date_to_week(year,month,day),实现功能输入年月日后返回星期几,例如date_to_week(2020,11,1),返回:星期日。 提示:
1990年1月1日是星期一,定义函数date_to_week(year,month,day),实现功能输入年月日后返回星期几,例如date_to_week(2020,11,1),返回:星期日。 提示:
2022-04-23 14:48:00 【jinjuana521】
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
版权声明
本文为[jinjuana521]所创,转载请带上原文链接,感谢
https://blog.csdn.net/jinjuana521/article/details/124348898
边栏推荐
- 科技的成就(二十一)
- OC 转 Swift 条件编译、标记、宏、 Log、 版本检测、过期提示
- Advanced application of I / O multiplexing: Processing TCP and UDP services at the same time
- Achievements in science and Technology (21)
- SQLSERVER事物与锁的问题
- Unity_代码方式添加绑定按钮点击事件
- 一款不错的工具:aardio
- Mq-2 and DS18B20 fire temperature smoke alarm system design, 51 single chip microcomputer, with simulation, C code, schematic diagram, PCB, etc
- ASEMI三相整流桥和单相整流桥的详细对比
- vscode中文插件不生效问题解决
猜你喜欢
外包幹了四年,廢了...
Is asemi ultrafast recovery diode interchangeable with Schottky diode
Mq-2 and DS18B20 fire temperature smoke alarm system design, 51 single chip microcomputer, with simulation, C code, schematic diagram, PCB, etc
Swift Protocol 关联对象 资源名称管理 多线程GCD 延迟 once
[servlet] detailed explanation of servlet (use + principle)
MySQL error packet out of order
想要成为架构师?夯实基础最重要
Sword finger offer II 019 Delete at most one character to get palindrome (simple)
机器学习之逻辑回归(Logistic Regression)原理讲解和实例应用,果断收藏
Parameter stack pressing problem of C language in structure parameter transmission
随机推荐
UML项目实例——抖音的UML图描述
async void 导致程序崩溃
Detailed explanation of C language P2 selection branch statement
[NLP] HMM hidden Markov + Viterbi word segmentation
SHT11传感器的温度湿度监控报警系统单片机Proteus设计(附仿真+论文+程序等)
GIS数据处理-cesium中模型位置设置
MCU function signal generator, output four kinds of waveforms, adjustable frequency, schematic diagram, simulation and C program
Four ways of SSH restricting login
Bingbing learning notes: take you step by step to realize the sequence table
[jz46 translate numbers into strings]
Thread synchronization, life cycle
拼接hql时,新增字段没有出现在构造方法中
PWM speed regulation control system of DC motor based on 51 single chip microcomputer (with complete set of data such as Proteus simulation + C program)
Go basic reflection
2-GO variable operation
Interviewer: let's talk about the process of class loading and the mechanism of class loading (parental delegation mechanism)
Want to be an architect? Tamping the foundation is the most important
ASEMI整流模块MDQ100-16在智能开关电源中的作用
Set up an AI team in the game world and start the super parametric multi-agent "chaos fight"
epoll 的 ET,LT工作模式———实例程序