How to append values to a list of lists using other list of lists and doing mathematical operations
<p>I have several lists of lists:</p>

<pre><code>crt = [[80, 90, 6, 5.4, 8, 5], [65, 58, 2, 9.7, 1, 1], [83, 60, 4, 7.2, 4, 7],
       [40, 80, 10, 7.5, 7, 10], [52, 72, 6, 2, 3, 8], [94, 96, 7, 3.6, 5, 6]]

nc = [[1, 2, 3, 4, 5, 6], [1, 1, 1, 1, 1, 1], [-1, 1, -1, -1, -1, 1],
      [2, 3, 5, 6, 1, 6], [10, 0, 0.5, 1, 0, 0], [0, 30, 5, 3, 0, 0],
      [0, 0, 0, 0, 0, 5]]

DivMatrix = [[[0, -15, 3, -40, -28, 14], [15, 0, 18, -25, -13, 29],
              [-3, -18, 0, -43, -31, 11], [40, 25, 43, 0, 12, 54],
              [28, 13, 31, -12, 0, 42], [-14, -29, -11, -54, -42, 0]],
             [[0, 32, 30, 10, 18, -6], [-32, 0, -2, -22, -14, -38],
              [-30, 2, 0, -20, -12, -36], [-10, 22, 20, 0, 8, -16],
              [-18, 14, 12, -8, 0, -24], [6, 38, 36, 16, 24, 0]],
              [[0, -4, -2, 4, 0, 1], [4, 0, 2, 8, 4, 5],
              [2, -2, 0, 6, 2, 3], [-4, -8, -6, 0, -4, -3],
              [0, -4, -2, 4, 0, 1], [-1, -5, -3, 3, -1, 0]],
             [[-0.0, 4.299999999999999, 1.7999999999999998,
               2.0999999999999996, -3.4000000000000004, -1.8000000000000003],
              [-4.299999999999999, -0.0, -2.499999999999999,
               -2.1999999999999993, -7.699999999999999, -6.1],
              [-1.7999999999999998, 2.499999999999999, -0.0,
               0.2999999999999998, -5.2, -3.6], [-2.0999999999999996,
               2.1999999999999993, -0.2999999999999998, -0.0, -5.5, -3.9],
              [3.4000000000000004, 7.699999999999999, 5.2, 5.5, 0, 1.6],
              [1.8000000000000003, 6.1, 3.6, 3.9, -1.6, -0.0]],
             [[0, -7, -4, -1, -5, -3], [7, 0, 3, 6, 2, 4],
              [4, -3, 0, 3, -1, 1], [1, -6, -3, 0, -4, -2],
              [5, -2, 1, 4, 0, 2], [3, -4, -1, 2, -2, 0]],
             [[0, 4, -2, -5, -3, -1], [-4, 0, -6, -9, -7, -5],
              [2, 6, 0, -3, -1, 1], [5, 9, 3, 0, 2, 4], [3, 7, 1, -2, 0, 2],
              [1, 5, -1, -4, -2, 0]]]
</code></pre>

<p>I want to create a list of lists with the same size as <code>DivMatrix</code>. The creation must start with a for loop and then with 6 different if statements, each one of them representing a type equation with <code>nc[3]</code>. I want to build the first if statement and then I will build the others which are more complicated.I have this algorithm so far but it is wrong.</p>

<pre><code>pref_indic = []
for x in range(len(crt)):
    if (nc[3][x] == 1):
        prolist = []
        for y in range(len(DivMatrix[x])):
            prolist2 = []
            for z in range(len(DivMatrix[x])):
                if (DivMatrix[y][z]&lt;=0):
                    prolist2.append(0)
                else:
                    prolist2.append(1)
            prolist.append(prolist2)
            pref_indic.append(prolist)
    else:
       print "wrong function type"

print pref_indic
</code></pre>

<p>If the <code>nc[3][x] = 1</code>  which means if the type is type 1, then if the value in <code>DivMatrix[x]&lt;=0</code> then append 0, else append 1.</p>

<p>So as a result, for <code>nc[3][4]</code> which is equal to 1, I will get the following list appended:</p>

<pre><code>pref_indic[4] = [[0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 1],
                 [1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0],
                 [1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0]]
</code></pre>

<p>Sorry for the size of the post.</p>