# 怎么设置变量

0

temper_list1 = []
temper_list2 = []
temper_list3 = []
temper_list4 = []
step_list2 = [27,31,39,43]#
for i, val in enumerate(self.step_list):
if val == '27':
temper_list1.append(self.temper_list[i])
# max_temper = max(temper_list1)
# min_temper = min(temper_list1)
# tem_rise1 = round(float(max_temper)-float(min_temper),2)
elif val == '31':
temper_list2.append(self.temper_list[i])
max_temper = max(temper_list2)
min_temper = min(temper_list2)
tem_rise2 = round(float(max_temper)-float(min_temper),2)
elif val == '39':
temper_list3.append(self.temper_list[i])
max_temper = max(temper_list3)
min_temper = min(temper_list3)
tem_rise3 = round(float(max_temper)-float(min_temper),2)
elif val == '43':
temper_list4.append(self.temper_list[i])
max_temper = max(temper_list4)
min_temper = min(temper_list4)
tem_rise4 = round(float(max_temper)-float(min_temper),2)
print('033C温升是',round(float(max(temper_list1))-float(min(temper_list1)),2))
print('05C温升是',tem_rise2)
print('2C温升是',tem_rise3)
print('3C温升是',tem_rise4)

mls1212 | 初学一级 | 园豆：34

harrylyx 1年前

“我这个列表的内容每次都是变化的，能不能作为一个变量，变化后，if 直接调用了”，这句话也听不懂

0

mls1212 | 初学一级 |园豆：34 | 2022-09-28 10:55

0

ensleep | 园豆：1682 (小虾三级) | 2022-09-23 17:15

您需要登录以后才能回答，未注册用户请先注册