#this program will encrypt and decrypt #the message using Caesar cipher #encryptedLetter=(originalLetter+3)%26 #originalLetter=(encryptedLetter-3)%26 #we will assume that ORIGINAL message (PLAINTEXT) #consits of upper case letters only #we will assume that CIPHERTEXT #consits of lower case letter only #your program must have a choice #1 - encryption #2 - decryption A_ASCII=65 a_ASCII=97 SHIFT = 3 ALPHABET = 26 def encrypt(plaintext): ciphertext="" for i in range(len(plaintext)): numeric=ord(plaintext[i])-A_ASCII encrNum=(numeric + SHIFT)% ALPHABET + a_ASCII ciphertext=ciphertext+chr(encrNum) return ciphertext def decrypt(ciphertext): plaintext="" for i in range(len(ciphertext)): numeric=ord(ciphertext[i])-a_ASCII decrNum=(numeric-SHIFT)%ALPHABET + A_ASCII plaintext += chr(decrNum) return plaintext def menu(choice): if (choice==1): plain=input("enter plaintext ") if(plain.isupper()): print("ciphertext is ") print(encrypt(plain)) else: print("error ") elif(choice == 2): cipher=input("enter ciphertext ") if(cipher.islower()): print("plaintext is ") print(decrypt(cipher)) else: print("error ") else: print("invalid choice ") def main(): my_list=['ALICE', 'BOB', 'YANA', 'BONY'] encr_list=[] for i in my_list: encr_list.append(encrypt(i)) print(encr_list) #choice=int(input("enter 1 to encrypt 2 to decrypt ")) #menu(choice) main()