title: unsupported operand type(s) for +=: 'int' and 'list'
body: <p><strong>[EDIT FOR FUTURE READERS] In this post, I bring up the term "vector" a lot. When I said vector, I meant a vector in physics and at the time did not know that vector is also a datatype in programming.</strong></p>
  
  <p>A little piece of my code is here:  </p>
  
  <pre><code>x_value = item[0]
  y_value = item[1]
  x_total += x_value
  y_total += y_value
  </code></pre>
  
  <p>The error I'm getting is this:</p>
  
  <pre><code>File "main.py", line 65, in &lt;module&gt;                                                                                                                                          
      get_best();                                                                                                                                                                 
    File "main.py", line 51, in get_best                                                                                                                                          
      x_total += x_value                                                                                                                                                                
  TypeError: unsupported operand type(s) for +=: 'int' and 'list'                                                                                                                 
  sh-4.3$
  </code></pre>
  
  <p>And I just don't understand why this is not okay.</p>
  
  <p>Here is all of my code (It might not be great, but I'm a true beginner and am just lost pretty much all of the time):</p>
  
  <pre><code># Program takes all vectors, puts them in a list, iterates through every possible combination, 
  # And selects the one with the result closest to 0 aka starting point.
  import math;
  import itertools;
  vectors = [];
  temp_list = [];
  best_vector = [];
  
  A = [11.5, 30];
  B = [9.2, 55];
  C = [8.7, 125];
  D = [12.9, 190];
  E = [5.5, 340];
  F = [8.0, 295];
  G = [4.2, 140];
  H = [10.0, 315];
  I = [14.3, 220];
  J = [5.6, 70];
  K = [7.5, 160];
  L = [3.6, 255];
  M = [7.1, 200];
  N = [5.9, 15];
  O = [6.4, 285];
  P = [9.9, 35];
  Q = [12.1, 135];
  R = [11.0, 115];
  S = [5.8, 245];
  T = [9.4, 300];
  #Just get them in a list to iterate them initially
  
  all_vectors = [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T];
  for vector in all_vectors:
      x_component = vector[0]*(math.cos(vector[1]*(180/math.pi)));
      y_component = vector[0]*(math.sin(vector[1]*(180/math.pi)));
      vector = [x_component, y_component];
      vectors.append(vector);
  
  #Vector list with components.
  best = 100;
  options = [itertools.combinations(vectors,10)];
  
  def get_best ():
      x_total = 0;
      y_total = 0;
      x_value = 0;
      y_value = 0;
      result = 0;
      for item in temp_list:
          x_value = item[0]
          y_value = item[1]
          x_total += x_value
          y_total += y_value
      result = sqrt(((x_total)^2)+((y_total)^2))
      if result &lt; best:
          best = result
          best_vector.append(result + "meters off")
          for item in temp_list:
              best_vector.append(item);
  
  #Loop through all possible options, roughly 170,000 options.
  
  for opt in options:
      for char in opt:
          temp_list.append(char);
          get_best();
      print best_vector;
  </code></pre>