【发布时间】:2015-09-29 23:10:57
【问题描述】:
我有一个问题: 我有两个列表
Pipe_sizes = [15,15,22,15,32,45]
Flow_rate = [0.1,0.3,1,2,0.4,1.5]
我想使用逻辑运算符来更改列表 Pipe_size,例如:
if Flow_rate <= 0.2 then the pipe size is 15
if Flow_rate > 0.2 and <= 1 then the pipe size is 22
if Flow_rate > 1 and <=1.9 then the pipe size is 32
if Flow_rate > 1.9 then the pipe size is 45
我该怎么做?
【问题讨论】:
-
“更改列表
Pipe_size”是什么意思?您的意思是从Pipe_sizes中选择一个值吗? -
我并不清楚你的规则来自哪里。例如。 > 1.9 = 45 来自哪里?为什么是 1.9?
-
你想用两个列表和
bisect来做到这一点。
标签: python python-2.7 python-3.x ipython