title: IndexError in array PYTHON
body: <p>I am tring to write this C# function in Python, unfortunatly I have this <strong>ERROR</strong>: <code>IndexError: list assignment index out of range</code> in <code>Population.BinaryX.insert([i][j], dec)</code> line. Can anyone tell me how can I fix this problem?! What`s wrong I did?</p>
  
  <p><strong>C# CODE:</strong></p>
  
  <pre><code>public class Population
      {
          public float[] CodedX = new float[20];
          public float[,] BinaryX = new float[10, 8];
      }
  
  private void BinaryTranslating()
          {
              int dec;
              int j = 0;
              for (var i = 0; i &lt; 10; i++)
              {
                  while (Population.CodedX[i] &gt; 1 &amp; j &lt; 8)
                  {
                      dec = (int)Population.CodedX[i] % 2;
                      Population.BinaryX[i, j] = dec;
                      Population.CodedX[i] /= 2;
                      j++;
                  }
                  j = 0;
              }
          }
  
   private void DecimalTranslating()
          {
              for (var i = 0; i &lt; 10; i++)
              {
                  Population.CodedX[i] = Population.BinaryX[i, 7] * 128 + Population.BinaryX[i, 6] * 64 + 
                                         Population.BinaryX[i, 5] * 32 + Population.BinaryX[i, 4] * 16 + 
                                         Population.BinaryX[i, 3] * 8 + Population.BinaryX[i, 2] * 4 + 
                                         Population.BinaryX[i, 1] * 2 + Population.BinaryX[i, 0];
  
              }
          }
  </code></pre>
  
  <p><strong>Python CODE:</strong></p>
  
  <pre><code>class Population:
  CodedX = []
  BinaryX = [[], []]
  
  class Application:
  @staticmethod
      def binary_translating():
          j = 0
          for i in range(10):
              while Population.CodedX[i] &gt; 1 &amp; j &lt; 8:
                  dec = int(Population.CodedX[i]) % 2
                  Population.BinaryX.insert([i][j], dec)
                  Population.CodedX[i] /= 2
                  j += 1
              j = 0
  
  @staticmethod
      def decimal_translating():
          for i in range(10):
              new_item = Population.BinaryX[i][7] * 128 + Population.BinaryX[i][6] * 64 + Population.BinaryX[i][5] * 32 +\
                         Population.BinaryX[i][4] * 16 + Population.BinaryX[i][3] * 8 + Population.BinaryX[i][2] * 4 +\
                         Population.BinaryX[i][1] * 2 + Population.BinaryX[i][0]
              Population.CodedX.insert(i, new_item)
  </code></pre>