In: Computer Science
Please create a Python program that can convert a text string to an encrypted message and convert the encrypted message back to the original message.
Important: please use a dictionary data type and append function.
#dictionary have no append method.only list have append method.dictionary have update method
#source code:
import random
small=[chr(i) for i in range(97,123)]
enc=[]
count=0
while(count!=26):
n=random.randint(97,122)
if chr(n) not in enc:
enc.append(chr(n))
count=count+1
a=input("Enter plain text:")
cipher=""
for i in range(len(a)):
for j in range(len(small)):
if(a[i]==small[j]):
cipher=cipher+enc[j]
print("cipher text:",cipher)
b=input("Enter encryption text:")
plain=""
for i in range(len(b)):
for j in range(len(enc)):
if(b[i]==enc[j]):
plain=plain+small[j]
print("plain text:",plain)
#output:
#if you have any doubt comment below.....