代码拉取完成,页面将自动刷新
# -*- coding:utf-8 -*-
def count_pm(*args):
alist = list([round(i*2-8,2) for i in args]) #计算三种颗粒浓度
result = []
for pm in alist:
pm_abs = abs(pm)
result.append(generate_iso_code(pm_abs))
print (result)
return result
def generate_iso_code(x):
pm_value = [0.01,0.02,0.04,0.08,0.16,0.32,0.64,1.3,2.5,5,10,20,40,80] #颗粒浓度
iso = list(range(1,25)) #iso级别,共24级
for i in range(len(pm_value)): #for循环得到某个浓度范围的iso4006级别
if pm_value[i] < x <= pm_value[i+1]:
iso_code = iso[i]
break
return iso_code
if __name__ == '__main__':
count_pm(7.95,5.85,3.98)
count_pm(7.918,5.949,5.456)
count_pm(6.916,3.956,3.956)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。