title: Checking a string for adjacent keyboard characters
body: <p>I'm trying to see if characters in a string are adjacent on the keyboard.</p>
  
  <p>This code initializes the keyboard as the 3d array "Array3":</p>
  
  <pre><code>KeyboardRow1 = ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", ""]
  KeyboardRow2 = ["", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", ""] 
  KeyboardRow3 = ["", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "", "", ""] 
  KeyboardRow4 = ["", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "", "", ""]
  KeyboardRow1S = ["~", "!", "@", "#", "$", "%", "^", "&amp;", "*", "(", ")", "_", "+", ""]
  KeyboardRow2S = ["", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", "|"]
  KeyboardRow3S = ["","A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "", "", ""] 
  KeyboardRow4S = ["", "Z", "X", "C", "V", "B", "N", "M", "&lt;", "&gt;", "?", "", "", ""]
  Array2R = [KeyboardRow1, KeyboardRow2, KeyboardRow3, KeyboardRow4]
  Array2S = [KeyboardRow1S, KeyboardRow2S, KeyboardRow3S, KeyboardRow4S]
  Array3 = [Array2R, Array2S]
  </code></pre>
  
  <p>This code turns each character of the entered password into coordinates of where it is in the array and stores those coordinates in KeyboardPositions.</p>
  
  <pre><code>KeyboardPositions = []
  for z in range(0,PasswordLength):
      for i in range(2):
          for j in range(4):
              for k in range (14):
                  if Password[z] == str(Array3[i][j][k]):
                      KeyboardPositions.append((i,j,k))
  </code></pre>
  
  <p>This code, where I am having trouble, checks for adjacency.</p>
  
  <pre><code>  for x in range(PasswordLength-1):
          for y in range(3):
              if KeyboardPositions[x][y] == (KeyboardPositions[x+1][y]-1) or KeyboardPositions[x][y] == (KeyboardPositions[x+1][y]+1):
                  Adjacency = Adjacency + 1
  
  print("There are " + str(Adjacency) + " adjacent characters")
  </code></pre>
  
  <p>What the last piece of code is trying to do is see if the row, column or shift (if shift is held, 1 or 0) coordinates are +- 1 of each other. However, it counts things like "t" and "a" adjacent, because they are only 1 row apart. How can I fix this ? Thanks</p>