title: Check if all values in list are greater than a certain number
body: <pre><code>my_list1 = [30,34,56]
  my_list2 = [29,500,43]
  </code></pre>
  
  <p>How to I check if all values in list are >= 30? <code>my_list1</code> should work and <code>my_list2</code> should not.</p>
  
  <p>The only thing I could think of doing was:</p>
  
  <pre><code>boolean = 0
  def func(ls):
      for k in ls:
          if k &gt;= 30:
              boolean = boolean + 1
          else:
              boolean = 0
      if boolean &gt; 0:
          print 'Continue'
      elif boolean = 0:
          pass
  </code></pre>
  
  <h1>Update 2016:</h1>
  
  <p>In hindsight, after dealing with bigger datasets where speed actually matters and utilizing <code>numpy</code>...I would do this:</p>
  
  <pre><code>&gt;&gt;&gt; my_list1 = [30,34,56]
  &gt;&gt;&gt; my_list2 = [29,500,43]
  
  &gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; A_1 = np.array(my_list1)
  &gt;&gt;&gt; A_2 = np.array(my_list2)
  
  &gt;&gt;&gt; A_1 &gt;= 30
  array([ True,  True,  True], dtype=bool)
  &gt;&gt;&gt; A_2 &gt;= 30
  array([False,  True,  True], dtype=bool)
  
  &gt;&gt;&gt; ((A_1 &gt;= 30).sum() == A_1.size).astype(np.int)
  1
  &gt;&gt;&gt; ((A_2 &gt;= 30).sum() == A_2.size).astype(np.int)
  0
  </code></pre>
  
  <p>You could also do something like: </p>
  
  <pre><code>len([*filter(lambda x: x &gt;= 30, my_list1)]) &gt; 0
  </code></pre>