title: How i fix Traceback (most recent call last):
body: <p>Hello I tried to fix this but I couldn't
  This is my code:</p>
  <pre><code>import random
  
  Cromosomas=[[random.randint(1, 1010) for i in range(3)] for j in range(800)]
  Z=[]
  Fitness=[]
  P=[]
  C=[]
  Padres=[]
  
  def funcOb(Arreglo):
      return 0.2*Arreglo[0]**2+0.08*Arreglo[1]**2+0.18*Arreglo[2]**2+0.1*(Arreglo[0]*Arreglo[1])+0.04*(Arreglo[0]*Arreglo[2])+0.06*(Arreglo[1]*Arreglo[2])-0.14*Arreglo[0]-0.11*Arreglo[1]-0.1*Arreglo[2]+120+abs(Arreglo[0]+Arreglo[1]+Arreglo[2]-1000)-10
  
  for i in range(0,800):
      Z.append(funcOb(Cromosomas[i]))
  for i in range(0,800):
      Fitness.append(1/(1+Z[i]))
  total=sum(Fitness)
  
  for i in range(0,800):
      P.append(Fitness[i]/total);
  A=0
  for i in P:
      A=A+i
      C.append(A)    
      
  R=[random.random()for i in range(800)]
  for i in range(0,800):
      for j in range(0,800):
      if R[i]&lt;=C[j]:
          Cromosomas[i]=Cromosomas[j]
          break
  def mutar(Arreglo1,Arreglo2):
      b=random.randint(0, 2)
      if Arreglo1[b]&lt;=Arreglo2[b]:
      Arreglo2[b]=Arreglo1[b]
      return Arreglo2
      if Arreglo1[b]&gt;=Arreglo2[b]:
      Arreglo1[b]=Arreglo2[b]
      return Arreglo1
  
  for i in range(0,800):
      r=random.random()
      if r&lt;(0.3):
      n=Cromosomas[i]
      if n not in Padres:
          Padres.append(n)
      r=0     
  
  for i in range(0,len(Padres)-1):
      if len(Padres)==1:
      Cromosomas[i]=[Padres[i][0],Padres[i][1],Padres[i][2]] 
      else:
      lista=mutar(Padres[i],Padres[i+1])
      Cromosomas[i]=[lista[0],lista[1],lista[2]]
      
  for i in range(0,480):
      Cromosomas[Cromosomas==random.randint(1, 2400)]=random.randint(1, 800)      
  
  for m in range(0,800):
      print(funcOb(Cromosomas[m]))
  </code></pre>
  <p>error:</p>
  <pre><code>Traceback (most recent call last):
      File &quot;main.py&quot;, line 59, in &lt;module&gt;
      print(funcOb(Cromosomas[m]))  
      File &quot;main.py&quot;, line 10, in funcOb
      return 0.2*Arreglo[0]**2+0.08*Arreglo[1]**2+0.18*Arreglo[2]
  **2+0.1*(Arreglo[0]*Arreglo[1])+0.04*(Arreglo[0]*Arreglo[2])+0.
  06*(Arreglo[1]*Arreglo[2])-0.14*Arreglo[0]-0.11*Arreglo[1]-0.1*
  Arreglo[2]+120+abs(Arreglo[0]+Arreglo[1]+Arreglo[2]-1000)-10
  TypeError: 'int' object has no attribute '__getitem__'
  </code></pre>
  <p>This error occurs when I try to run the last function of my code and I have no idea why the function that I call at the end is already one that I had already used and it does not give me a problem, also if I try other methods such as defining another function appears the same mistake.
  Thank´s for help</p>