title: Modifying a program to Decrypt a message using a past encrypted alphabet on python
body: <p>I need help in writing the second part to this program, which is almost complete. I finish writing the part in which an alphabet is encrypted, but now I find myself stuck in trying to use the new encryption as a sort of decoder ring, to decrypt a a random scrambled message that someone might input into the program.</p>
  
  <p>So to makes this easier to understand, lets say the <em>encryption</em> part of this program gives you: <strong>NHPWJXEYOZMAFUSCIGLVTDBKRQ</strong></p>
  
  <p>Now someone would  type some random message encrypted using the new scrambled alphabet. So lets say someone types: <strong>VYOL OL FR 1LV LJPGJV FJLLNEJ!</strong></p>
  
  <p>Now the program that I need to write will have to use the scrambled alphabet to decoded the message and print: <strong>THIS IS MY 1ST SECRET MESSAGE!</strong></p>
  
  <p>If anyone can help, I'll appreciate it. If it still sounds confusing, just ask. Th program that I have is below:</p>
  
  <pre><code>           # ENCODE a secret message
              # Scramble the alphabet, read a secret message, encode it, print scrambled
  
              import random
  
              def main():
  
                  encryption()
  
                  decryption()
  
              def encryption():
  
                  encrypt=["*"]*26   # all letters available
                  print(encrypt)
  
                  print("Alphabet:  ", end="")
                  for numbah in range(26):
                      #converts numbah into a letter
                      letter = chr(numbah+65) # converts 0-25 --&gt; 'A' = 'Z'
  
                      print(letter, end="")
  
                      #Reminder: find an empty position for that letter to be placed
  
                      notfound = True
                      while notfound:
                          possible_position = random.randint(0,25)
                          if encrypt[possible_position] == "*":
                              notfound = False
                      encrypt[possible_position] = letter
  
                  print("\nScrambled: " , end="")
                  for numbah in range(26):
                      print(encrypt[numbah], end="")
  
                  print("\n\n")
  
                  msg=input("Now, please type your secret message to encode: ")
                  print("Your secret message:  " + msg)
                  print("Your message encoded: ", end="")
  
                  # reminder non alphabetic characters should 'float thru' unchanged!
  
                  for alpha in msg.upper():
                      if alpha &lt; "A" or alpha &gt; "Z":
                          print(alpha, end="")
                      else:
                          print( encrypt[ ord(alpha) - 65], end="")
  
                  print("\n")
  
              def decryption():
  
                  scram_alph = input("Input the scrambled alphabet from the early prog:  ")
  
                  scram_mess = input("Input the scrambled messgae you want decoded:  ")
  
  
  
  
  
  
  
              main()
  </code></pre>