title: python'S TypeError of tuple which is not defined
body: <p>I am just making my python program.here below is my code and it returns: </p>
  
  <pre><code>File "relation.py", line 134, in &lt;module&gt;
      k = z1[i][0] = sampling(a[l, :], b[l, :], z1_sum[i], alpha[l, :], k_l)
  TypeError: list indices must be integers, not tuple
  </code></pre>
  
  <p>In my code(here below), I did not define any tuple.so i have no idea what is the problem of this code.</p>
  
  <pre><code>import random
  import numpy as np
  import math
  
  
  
  def sampling(a, b, I, alpha, length):
      summary = 0
      N = len(alpha)
      for i in range(N):
          A = math.gamma(a[i] + I[i]) * math.gamma(b[i] + length - I[i]) / math.gamma(a[i] + b[i] + I[i])
          B = math.gamma(a[i] + b[i]) / (math.gamma(a[i]) * math.gamma(b[i]))
          value = alpha[i] * A * B
          summary += value
          result.append(value)
  
  
      choose = random.randomrange(summary)
  
      num = N - 1
  
      for i in range(N):
          choose -= result[i]
          if choose &lt; 0:
              num = i
              break
  
      return num
  
  def delta(x, y):
      if x == y:
          return 1
      return 0
  
  data = []
  
  print("please input (k, l):")
  num = map(int, raw_input().split())
  
  k_l = k = num[0]
  l_l = l = num[1]
  
  param_p = [[0 for i in range(k)] for j in range(l)]
  param_n = [[0 for i in range(k)] for j in range(l)]
  param_k = [0] * k
  param_l = [0] * l
  count = 1000
  
  print("please input (N1, N2):")
  number = map(int, raw_input().split())
  N1 = number[0]
  N2 = number[1]
  
  random.randint(50, 100)
  z1 = []
  z2 = []
  z1_sum = [2 for i in range(N1)]
  z2_sum = [2 for i in range(N2)]
  
  value = 0
  
  alpha = [[2 for i in range(k)] for j in range(l)]
  a = np.array([[2 for i in range(k)] for j in range(l)])
  b = np.array([[2 for i in range(k)] for j in range(l)])
  
  for i in range(N1):
      z1.append([value, i],)
      if i % k == k - 1:
          value = 0
      else:
          value += 1
  
  value = 0
  
  for i in range(N2):
      z2.append([value, i],)
      if i % l == l - 1:
          value = 0
      else:
          value += 1
  
  print(z1)
  print(z2)
  
  print("please input relation-data:")
  
  for i in range(N2):
      line = map(int, raw_input().split())
      data.append(line)
  
  print(data)
  
  param_p[0][0] = -1
  print(param_p[1][0])
  param_p[0][0] = 0
  
  
  for i in range(N2):
      l = z2[i][0]
      for j in range(N1):
          k = z1[j][0]
          z1_sum[i] += data[i][j]
          z2_sum[j] += data[i][j]
          param_p[l][k] += data[i][j]
          param_n[l][k] += 1 - data[i][j]
          param_k[k] += data[i][j]
          param_l[l] += data[i][j]        
  
  print(param_p)
  print(param_n)
  print(param_k)
  print(param_l)
  
  #sampling(a, b, I, alpha, length)
  
  k = 0
  l = 0
  
  for n in range(count):
      for i in range(N1):
          temp = z1[i][0]
          for j in range(l_l):
              alpha[j][temp] += param_l[j]
              a[j][temp] += param_p[j][temp]
              b[j][temp] += param_n[j][temp]
  
              I = delta(z1[i][0], temp)
  
              param_p[j][temp] -= z1_sum[i] * I
              param_n[j][temp] -= (k_l - z1_sum[i]) * I
              param_l[j] -= I
  
          k = z1[i][0] = sampling(a[l, :], b[l, :], z1_sum[i], alpha[l, :], k_l)
          for j in range(l_l):
              alpha[j][temp] -= param_l[j]
              a[j][temp] -= param_p[j][temp]
              b[j][temp] -= param_n[j][temp]
  
              I = delta(z1[i][0], k)
  
              param_p[j][k] += z1_sum[i] * z1_sum[i] * I
              param_p[j][k] += (k_l - z1_sum[i]) * z1_sum[i] * I
              param_l[j] += z1_sum[i] * I
  
      for i in range(N2):
          temp = z2[i][0]
          for j in range(k_l):
              alpha[temp][j] += param_k[j]
              a[temp][j] += param_p[temp][j]
              b[temp][j] += param_n[temp][j]
  
              I = delta(z2[i][0], temp)
  
              param_p[temp][j] -= z2_sum[i] * I
              param_n[temp][j] -= (l_l - z2_sum[i]) * I
              param_k[j] -= I
  
          l = z2[i][0] = sampling(a[:, k], b[:, k], z2_sum[i], alpha[:, k], l_l)
          for j in range(k_l):
              alpha[temp][j] -= param_k[j]
              a[temp][j] -= param_p[temp][j]
              b[temp][j] -= param_n[temp][j]
  
              I = delta(z2[i][0], l)
  
              param_p[l][j] += z2_sum[i] * I
              param_n[l][j] += (l_l - z2_sum[i]) * I
              param_k[j] += I
  
      print("Hello")  
  
  print(z1)
  print(z2)
  </code></pre>
  
  <p>As you can see, I only defined numpy and a[l, :] is not tuple at all.Ovserving of all, there is none of bussiness of tuple.only list elements is here.Why python returns error about tuple.</p>