pythan这题怎么做

请使用列表索引根据整型变量 month 判断特定月份有多少天,并将该值存储在整型变量 num_days 中。例如,如果 month 是 8,num_days 应该设为 31,因为第八个月份八月应该有 31 天

month = 8

days_in_month = [31,28,31,30,31,30,31,31,30,31,30,31]

# use list indexing to determine the number of days in month

print(num_days)


慕斯卡5910870
浏览 2870回答 4
4回答

weixin_慕妹1077343

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)

慕仰0518380

我没看懂题?num_days=days_in_month[month-1]

慕后端9321733

练习一下POST replay

慕后端9321733

练习一下POST replay
打开App,查看更多内容
随时随地看视频慕课网APP