为了账号安全,请及时绑定邮箱和手机立即绑定

pythan这题怎么做

pythan这题怎么做

请使用列表索引根据整型变量 month 判断特定月份有多少天,并将该值存储在整型变量 num_days 中。例如,如果 month 是 8,num_days 应该设为 31,因为第八个月份八月应该有 31 天month = 8days_in_month = [31,28,31,30,31,30,31,31,30,31,30,31]# use list indexing to determine the number of days in monthprint(num_days)
查看完整描述

4 回答

?
weixin_慕妹1077343

TA贡献1条经验 获得超0个赞

import calendar
list_number = []
list_month = []
year = input("请输入你的年份")
for n in range(1,13):
    montt = calendar.monthrange(int(year), n)
    list_number.append(montt)
for i in range(0,12):
    list_month.append(list_number[i][1])
print(list_month)


查看完整回答
反对 回复 2018-11-21
?
慕仰0518380

TA贡献1条经验 获得超0个赞

我没看懂题?

num_days=days_in_month[month-1]

查看完整回答
反对 回复 2018-09-17
?
慕后端9321733

TA贡献4条经验 获得超0个赞

练习一下POST replay

查看完整回答
反对 回复 2018-09-14
?
慕后端9321733

TA贡献4条经验 获得超0个赞

练习一下POST replay

查看完整回答
反对 回复 2018-09-14
  • 4 回答
  • 0 关注
  • 2859 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信