title: Python array elements in if statement
body: <p>I have some array with integers, and for loop. I am trying to test if some specific elements in array is bigger or smaller that some integer. This code explain it better:</p>
  
  <pre><code>array = [1,2,3,4,5]
  for i in range(5):
      if array[i] &gt;= 3:
          print(sometext)
      else:
          print(othertext)
  </code></pre>
  
  <p>But i got an ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()</p>
  
  <p>SOLUTION: I did indent it properly. This above is just simplification(some stupid example) of my code.
   I found where the error is. It is because I initialized array with numpy as </p>
  
  <p><code>a = numpy.empty(5)</code>
  and not like this:</p>
  
  <pre><code>a = [0 for i in range(5)]
  </code></pre>
  
  <p>Thank you everybody for your help</p>