title: How to loop a function over a array
body: <p>So here is the thing I would like to write a function that finds a specific set of numbers. So I have tries a few different ways</p>
  <p>I tried this way the Boolean way and kept getting the arguments</p>
  <pre><code>import numpy as np
  N = np.array([10,1,2,3,4,5,6,7,8,9])
  def function(N): 
      e = 0
      for i in range(n): 
          if i % 2 == 0: 
              e += a[i]
               sum(e)
  
  </code></pre>
  <p>Got the error for the above code
  <em>TypeError: only integer scalar arrays can be converted to a scalar index</em></p>
  <pre><code>import numpy as np
  N = np.array([10,1,2,3,4,5,6,7,8,9])
  def function(N):
      filter_arr = []
      for item in N:
          if(N% 2 ==0):
              filter_arr.append(True)
          else:
              filter_arr.append(False)
  newarr = N[filter_arr]
  print(sum(newarr))
  </code></pre>
  <p>So here is another attempt to get it right</p>
  <pre><code>import numpy as np
  N = np.array([10,1,2,3,4,5,6,7,8,9])
  def function(N):
      for item in N:
          if(N%2 ==0):
              return False
          else:
              return True
          
  even_numbers=filter(function, N)
  
  for N in even_numbers:
      print(N)
  </code></pre>
  <p>I get a numpy.int32 error</p>
  <pre><code>def function(N): 
      e = 1
      for i in range(0): 
          if (i % 2 == 0): 
              e *= N[i]
              print(e)
  </code></pre>
  <p>This is the closest I have gotten with no error but no result.
  So Looking for some help as to what I am doing wrong.</p>