当前位置:网站首页>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
边栏推荐
- eolink 如何助力远程办公
- Provided by Chengdu control panel design_ It's detailed_ Introduction to the definition, compilation and quotation of single chip microcomputer program header file
- 解决computed属性与input的blur事件冲突问题
- QT interface optimization: double click effect
- Using MATLAB programming to realize the steepest descent method to solve unconstrained optimization problems
- Find daffodils - for loop practice
- Go basic reflection
- I/O复用的高级应用之一:非阻塞 connect———使用 select 实现(也可以用 poll 实现)
- Achievements in science and Technology (21)
- 面试官:说一下类加载的过程以及类加载的机制(双亲委派机制)
猜你喜欢

1 - first knowledge of go language

ASEMI整流模块MDQ100-16在智能开关电源中的作用
![[servlet] detailed explanation of servlet (use + principle)](/img/7e/69b768f85bad14a71ce9fcef922283.png)
[servlet] detailed explanation of servlet (use + principle)

Mq-2 and DS18B20 fire temperature smoke alarm system design, 51 single chip microcomputer, with simulation, C code, schematic diagram, PCB, etc

金九银十,入职字节跳动那一天,我哭了(蘑菇街被裁,奋战7个月拿下offer)

LM317的直流可调稳压电源Multisim仿真设计(附仿真+论文+参考资料)

Chapter 7 of JVM series -- bytecode execution engine

What is the main purpose of PCIe X1 slot?

Thread synchronization, life cycle

外包干了四年,废了...
随机推荐
I/O复用的高级应用:同时处理 TCP 和 UDP 服务
详解TCP的三次握手
三、梯度下降求解最小θ
数组模拟队列进阶版本——环形队列(真正意义上的排队)
1N5408-ASEMI整流二极管1N5408
[jz46 translate numbers into strings]
capacitance
外包幹了四年,廢了...
SVN详细使用教程
Programming philosophy - automatic loading, dependency injection and control inversion
51 Single Chip Microcomputer Design of traffic light system (with Proteus simulation, C program, schematic diagram, PCB, thesis and other complete data)
eolink 如何助力远程办公
Introduction to Arduino for esp8266 serial port function
Proteus simulation design of DC adjustable regulated power supply (with simulation + paper and other data)
qt之.pro文件详解
DVWA之暴力破解(Brute Force)Low-->high
1-初识Go语言
First acquaintance with STL
阿里研发三面,面试官一套组合拳让我当场懵逼
I/O复用的高级应用之一:非阻塞 connect———使用 select 实现(也可以用 poll 实现)