title: Increment a square in a 2D list while decrementing all the others squares not involved - Python
body: <p>i have a 2D list, and im trying to update the value of a cell, while i have to decrement the values of the other cells i'm not incrementing.</p>
  <p>i have a 2D list called</p>
  <pre><code>PAWN = [
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0]
  ]
  </code></pre>
  <p>And in my code i'm updating all the square that involve a pawn move, for example, g3, h4, the matrix will update like this, adding a 0,1 for the move, and this works quite fine.</p>
  <pre><code>PAWN = [
         A  B  C  D  E  F  G  H
     8  [0, 0, 0, 0, 0, 0, 0, 0],
     7  [0, 0, 0, 0, 0, 0, 0, 0],
     6  [0, 0, 0, 0, 0, 0, 0, 0],
     5  [0, 0, 0, 0, 0, 0, 0, 0],
     4  [0, 0, 0, 0, 0, 0, 0, 0.1],
     3  [0, 0, 0, 0, 0, 0, 0.1, 0],
     2  [0, 0, 0, 0, 0, 0, 0, 0],
     1  [0, 0, 0, 0, 0, 0, 0, 0]
  ]
  </code></pre>
  <p>Here's snippet of my code:</p>
  <pre><code>white_moves = ['g3', 'h4']
      for moves in white_moves:
          delta = 0.1
          if len(moves) == 2: # for example g3
              y = moves[0]   #y = g
              x = int(moves[1]) #x = 3
  
              coordinate = {0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h'}
              c = coordinate.values()
              for key, value in coordinate.items():
                  if y == value:
                      indice_colonna = key
                  
              for letter in c:  
                  if letter == y:  # if value in dictionary is equal to my y
  
     
                      file = open('../data/tables/pedone.csv', 'r') #reading from csv file
                      reader = csv.reader(file)
                      PAWN = list(reader)
                      file.close()
                      new_pawn = PAWN    
      
                      new_pawn[8-x][indice_colonna] = round(float(PAWN[8-x][indice_colonna]) + delta, 1) #here im incrementing the value of square [g][3]
      
      
                      new_pawn = open(&quot;../data/tables/pedone.csv&quot;, 'w', newline='') #updating that file
                      writer = csv.writer(new_pawn)
                      writer.writerows(PAWN)
                      new_pawn.close()
                      break
  </code></pre>
  <p>How i can decrement all the other squares? from row 0 to 8 and column 0 to 8 but avoiding to decrement also the g3 square? im having troubles separating this two operations</p>
  <p>here what i've tried:</p>
  <pre><code>rows = 8
  columns = 8
  
  for i in range(rows):
      for j in range(columns):
          pedone[i][j] = -0.1
          pedone[8-x][indice_colonna] = + 2*0.1 #trying to add 2x the value 
  </code></pre>
  <p>but doesnt works, any suggestion?</p>