当前位置:网站首页>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
边栏推荐
- Outsourcing for four years, abandoned
- 多语言通信基础 06 go实现grpc的四种数据流模式实现
- 1-初识Go语言
- Bingbing learning notes: take you step by step to realize the sequence table
- 拼接hql时,新增字段没有出现在构造方法中
- ASEMI整流模块MDQ100-16在智能开关电源中的作用
- AT89C51 MCU digital voltmeter development, measuring range 0 ~ 5V, proteus simulation, schematic diagram, PCB and C program, etc
- do(Local scope)、初始化器、内存冲突、Swift指针、inout、unsafepointer、unsafeBitCast、successor、
- Four ways of SSH restricting login
- On the insecurity of using scanf in VS
猜你喜欢
OC 转 Swift 条件编译、标记、宏、 Log、 版本检测、过期提示
redis的五种数据类型
利用 MATLAB 编程实现最速下降法求解无约束最优化问题
Svn detailed use tutorial
ASEMI整流模块MDQ100-16在智能开关电源中的作用
Don't you know the usage scenario of the responsibility chain model?
Detailed explanation of C language knowledge points -- first knowledge of C language [1]
Arduino for esp8266串口功能简介
555 timer + 74 series chip to build eight way responder, 30s countdown, proteus simulation, etc
直流可调稳压电源的Proteus仿真设计(附仿真+论文等资料)
随机推荐
全连接层的作用是什么?
直流可调稳压电源的Proteus仿真设计(附仿真+论文等资料)
一个月把字节,腾讯,阿里都面了,写点面经总结……
I/O复用的高级应用之一:非阻塞 connect———使用 select 实现(也可以用 poll 实现)
Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?
在游戏世界组建一支AI团队,超参数的多智能体「大乱斗」开赛
Model location setting in GIS data processing -cesium
Master in minutes --- ternary operator (ternary operator)
面试官:说一下类加载的过程以及类加载的机制(双亲委派机制)
qt之.pro文件详解
555 timer + 74 series chip to build eight way responder, 30s countdown, proteus simulation, etc
QT actual combat: Yunxi calendar
【JZ46 把数字翻译成字符串】
3、 Gradient descent solution θ
Swift - Literal,字面量协议,基本数据类型、dictionary/array之间的转换
QT Detailed explanation of pro file
2-GO variable operation
MySQL报错packet out of order
解决computed属性与input的blur事件冲突问题
ArrayList collection basic usage