首页后端开发Python求Python代码从键盘输入年份和月份

求Python代码从键盘输入年份和月份

时间2023-06-05 02:15:01发布访客分类Python浏览533
导读:求Python代码从键盘输入年份和月份?import calendaryear = 2019if calendar.isleap(year :day_num=365else:day_num=366calendar库中的闰年算法def isl...

求Python代码从键盘输入年份和月份?

import calendar

year = 2019

if calendar.isleap(year):

day_num=365

else:

day_num=366

calendar库中的闰年算法

def isleap(year):

"""Return True for leap years, False for non-leap years."""

return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 求Python代码从键盘输入年份和月份
本文地址: https://pptw.com/jishu/61910.html
如何用vscode编写python 怎样在ppt里插入python代码高亮

游客 回复需填写必要信息