Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need help with python assigments as sooon as possible

TasechkaTasechka Posts: 1Member
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.