Programming
Cryptography Help

Question Description

I need support with this Programming question so I can learn better.

""" crypto.py
  Implements a simple substitution cypher
"""

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key =  "XPMGTDHLYONZBWEARKJUFSCIQV"
result = ""

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..."

#Define the menu
def menu():
   
  #print out the menu
  print ("SECRET DECODER MENU\n\n 0) Quit\n 1) Encode\n 2) Decode\n\nWhat do you want to do?")
   
  #take in user respose and return it
  userResponse = raw_input()
  return userResponse

#define the encoder
def encode(plain):
  #For loop to find the letters in plain
  for letters in plain:
  #find the same letters in alpha and set as location
  location = letters.find(alpha)
  #find the same location in the key
  result = key[location]
  return
main()

How do I make this work?

<br>


Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

Thank you for the opportunity to help you with your question!

Marketing satisfies these needs and wants through exchange processes and building long-term relationships.

Marketing Functions: Marketing have different functions such as Sales, Advertising & Brand Management, Research, Trade Marketing & Digital Marketing (Social Media Marketing is component / function of Digital Marketing).


Please let me know if you need any clarification. I'm always happy to answer your questions.

fitting k (56)
University of Virginia

Anonymous
Solid work, thanks.

Anonymous
The tutor was great. I’m satisfied with the service.

Anonymous
Goes above and beyond expectations !

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors