Numpy: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
<p>I've been trying to use numpy on Python to plot some data. However I'm getting an error I don't understand:</p>

<blockquote>
  <p>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()</p>
</blockquote>

<p>And this is the line supposed to cause the error (the third line):</p>

<pre><code>def T(z):
for i in range(3):
    if (z &lt;= z_tbl[i+1]):
        return T0_tbl[i]+a_tbl[i]*(z-z_tbl[i])
return 0
</code></pre>

<p>Those lists are just some lists of integers, and z is an integer too</p>

<p>How can i fix it?</p>