title: Python repeated list index out of range
body: <p>So I am trying to do a vigenere cipher (or something similar) for my GCSE work. However one problem I have come across is that my list index is always out of range, yet the code I have is exactly the same as when I had it before and there were no errors. This is my code:</p>
  
  <pre><code>#Encrypting
  def encrypt():
       #&gt;Creating initial variables
       plainText = str(input('Input your plain text \n --&gt; ')).upper()
       key = str(input('Input your key. Make sure it is as long as your plain text. \n --&gt; ')).upper()
  
      #&gt;Looping key
      if len(key) &lt; len(plainText):
          key = len(plainText)*key
      else:
          key = key
  
      #&gt;Creating lists for ASCII values of each letter
      plainAscii=[ord(i) for i in plainText]
      keyAscii=[ord(k) for k in key]
  
      #&gt;Shortening the keyAscii list
      while len(keyAscii) != len(plainAscii):
          keyAscii.pop(len(keyAscii) - 1)
  
      #&gt;Adding the values together and putting them into a new list
      cipherAscii=[]
      x = 0
      while x &lt; len(key):
          item = (plainAscii[x] + keyAscii[x]) - 75
          cipherAscii.append(item)
          x = x + 1
  
      #&gt;Making sure all numbers are within the 65 - 90 window
  
      newCipher=[]
      for c in cipherAscii:
          if c &gt; 90:
              c = c - 26
              newCipher.append(c)
          elif c &lt; 65:
              c = c + 26
              newCipher.append(c)
          else:
              newCipher.append(c)
  
      #&gt;Converting the ASCII back into regular letters
      cipherText=[chr(i) for i in newCipher]
  
      #&gt;Printing the cipher text
      for i in cipherText:
          print (i, end="")
  </code></pre>
  
  <p>Is my code wrong? Please help soon as I do not have a lot of time.</p>