title: Python vigenere cipher going further than needed?
body: <p>I am attempting to create the vigenere cipher in python and there seems to be a problem. Here is my encryption code: </p>
  
  <pre><code>def encryption():
      plaintext=input("Please enter the message you wish to encode.")
      #This allows the user to enter the message they wish to encrypt.
      keyword=input("Please enter your keyword, preferably shorter than the plaintext.")
      #This allows the user to enter a keyword.
      encoded=""
      #This creates a string for the user to input the encrypted message to.
      while len(keyword)&lt;len(plaintext):
          #This begins a while loop based on the fact that the length of the keyword is shorter than the length of the plaintext.
          keyword+=keyword
          #This repeats the keyword.
          if len(keyword)&gt;len(plaintext):
              #This sees if the string length of the keyword is now longer than the string length of the plaintext.
              newkey=keyword[:len(plaintext)]
              #This cuts the string length of the keyword
      for c in range(len(plaintext)):
          char=ord(plaintext[c])
          temp=ord(keyword[c])
          newchar=char+temp
          if newchar&gt;ord("Z"):
              newchar-=26
          newnewchar=chr(newchar)
          encoded+=newnewchar
      print(encoded)
  </code></pre>
  
  <p>I cannot seem to find the problem with it, however when I enter the plaintext "hello" and the keyword "hi" it come up with the following symbols: ¶´º»½. I think the addition in the for loop may be going too far.</p>