i need to use a cipher but I have to used the assigned code in the ciphering i know how to do it, but i am not sure how to add my own dictionary. Here is what i have so far:
[cipher = {"a":"g", "b":"h", "c":"i", "d":"j", "e":"k", "f":"l", "g":"m", "h":"n",
"i":"o", "j":"p", "k":"q", "l":"r", "m":"s", "n":"t", "o":"u", "p":"v",
"q":"w", "r":"x", "s":"y", "t":"z", "u":"a", "v":"b", "w":"c", "x":"d",
"y":"e", "z":"f"}
import string
def main():
print "This program will encode your messages using a Caesar Cipher"
print
key = cipher
message = raw_input("Ente r the message: ")
codedMessage = ""
for ch in message:
codedMessage = codedMessage + chr(ord(cipher) + key)
print "The coded message is:", codedMessage
main()]
[cipher = {"a":"g", "b":"h", "c":"i", "d":"j", "e":"k", "f":"l", "g":"m", "h":"n",
"i":"o", "j":"p", "k":"q", "l":"r", "m":"s", "n":"t", "o":"u", "p":"v",
"q":"w", "r":"x", "s":"y", "t":"z", "u":"a", "v":"b", "w":"c", "x":"d",
"y":"e", "z":"f"}
import string
def main():
print "This program will encode your messages using a Caesar Cipher"
key = cipher
message = raw_input("Ente r the message: ")
codedMessage = ""
for ch in message:
codedMessage = codedMessage + chr(ord(cipher) + key)
print "The coded message is:", codedMessage
main()]
Comment