title: writing a function with input of array...'int' object has no attribute '__getitem__'
body: <p>I'm a beginner in python. I wrote a function as follows:</p>
  
  <pre><code>import numpy as np
  
  def crossover(v1,v2):
  
      N=2
      v1n=np.zeros(shape=(1,N+1))
      v2n=np.zeros(shape=(1,N+1))
      beta=np.random.rand(1)
  
      v1n[0,0]=(1-beta)*v1[0]+beta*v2[0]
      v1n[0][1]=v1[1]
      v2n[0][0]=(1-beta)*v2[0]+beta*v1[0]
      v2n[0][1]=v2[1]
  
      return (v1n,v2n)
  </code></pre>
  
  <p>when I want to see crossover([3,4],[7,8]), the following error....:</p>
  
  <pre><code>Traceback (most recent call last):
  
    File "&lt;pyshell#82&gt;", line 1, in &lt;module&gt;
  
      crossover([4,5],[5,4])
  
    File "C:\Python27\crossover.py", line 11, in crossover
  
      v1n[0,0]=(1-beta)*v1[0]+beta*v2[0]
  
  TypeError: 'int' object has no attribute '__getitem__'
  </code></pre>