Create a program that assists in a basic form of cryptography, a substitution cypher. Write a program that will accept a phrase and convert it into code by substituting letters according to a key.
This program will also be an example of functions. You will be given a main function body. This function refers to a number of other functions which you will have to create. It's part of your job to figure out how these functions should be created and what their parameters and output should be.
The program is based on a standard text-based menu. You'll need to create methods (function) to display the menu, get input from it, and handle the details. Your program should encrypt and decrypt messages.
SECRET DECODER MENU
What do you want to do? 1
text to be encoded: python rocks
the instructor posted the start point
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = "XPMGTDHLYONZBWEARKJUFSCIQV"
keepGoing = True
response = menu()
if response == "1":
plain = raw_input("text to be encoded: ")
elif response == "2":
coded = raw_input("code to be decyphered: ")
elif response == "0":
print "Thanks for doing secret spy stuff with me."
keepGoing = False
print "I don't know what you want to do..."
I don't know how to write the menu and decode functions.
Please help, and if you can write the code here.
Thanks a lot.