python任意输入一个月份(1—12),判断该月份有多少天(不考虑2月份29天的...答:if n in [1,3,5,7,8,10,12]:return 31 elif n in [4,6,9,11]:return 30 elif n in [2]:return 28 else:return n, " is not a month"
python 创建一个列表,依次存放每个月对应的天数,假设2月份的天数为28天...答:l = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]while True:a = eval(input('请输入月份(输入0退出):'))if a == 0:exit()try:print('{}月共有{}天'.format(a, l[a-1]))except:print('你的输入有误!')
c语言题麻烦按题目要求写下然后告诉我大概过程谢谢答:1. 下面是一种使用分支结构语句来计算某日是当年第几天的算法:int year, month, day;// 读入年月日cin >> year >> month >> day;// 计算每月的天数int days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};// 如果是闰年,则二月有 29 天if (is_...