1个回答
展开全部
list_weather = [["周一","11℃","26℃","1级","优"],["周二","16℃","26℃","1级","优"],["周三","16℃","20℃","1级","优"],["周四","16℃","26℃","1级","优"]]
excellent_list = [x[0] for x in list_weather if x[-1]=='优']
print("空气为优的天数:{},它们分别是:".format(len(excellent_list)),end="")
for i in excellent_list:
if i == excellent_list[-1]:
print(i,'\n')
else:
print(i +",",end="")
wind_list = [x[0] for x in list_weather if int(x[2][0:-1])<=25 and int(x[-2][0])<3]
print("风力低于3级且最高气温不超过25℃的天数是{},分别是:".format(len(wind_list)),end="")
for i in wind_list:
if i == wind_list[-1]:
print(i,'\n')
else:
print(i +",",end="")
temperature_list = [x[0] for x in list_weather if int(x[2][0:-1])+int(x[1][0:-1])<=40]
print("平均气温低于20℃的天数是{},分别是:".format(len(temperature_list)),end="")
for i in temperature_list:
if i == temperature_list[-1]:
print(i,'\n')
else:
print(i +",",end="")
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询