Need help with python assigments as sooon as possible

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.

the menu

SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 1
text to be encoded: python rocks
AQULEWKEMNJ

the instructor posted the start point
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = "XPMGTDHLYONZBWEARKJUFSCIQV"

def main():
keepGoing = True
while keepGoing:
response = menu()
if response == "1":
plain = raw_input("text to be encoded: ")
print encode(plain)
elif response == "2":
coded = raw_input("code to be decyphered: ")
print decode(coded)
elif response == "0":
print "Thanks for doing secret spy stuff with me."
keepGoing = False
else:
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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories