Help me with modifying my code. Instruction: Create a module that decrypts the following message. Lezi$e$kviex$wyqqiv$fv
Posted: Sun May 15, 2022 1:17 pm
Help me with modifying my code.
Instruction:
Create a module that decrypts the following message.
Lezi$e$kviex$wyqqiv$fvieo The original
message was encrypted using a Caesar Cypher by four characters.
My code in python:
code= input("Enter the coded text: ")
distance= int(input("Enter the distance value: "))
plainText= ""
for txt in code:
ordvalue= ord(txt)
cipherValue = ordvalue - distance
if cipherValue < ord("a"):
cipherValue= ord("z") - \
(distance - (ord("a") - ordvalue - 1))
plainText += chr(cipherValue)
print(plainText)
Enter the coded text: Lezi$e$kviex$wyqqiv$fvieo Enter the distance value: 4 #ave?agreat2 summer2 break
Instruction:
Create a module that decrypts the following message.
Lezi$e$kviex$wyqqiv$fvieo The original
message was encrypted using a Caesar Cypher by four characters.
My code in python:
code= input("Enter the coded text: ")
distance= int(input("Enter the distance value: "))
plainText= ""
for txt in code:
ordvalue= ord(txt)
cipherValue = ordvalue - distance
if cipherValue < ord("a"):
cipherValue= ord("z") - \
(distance - (ord("a") - ordvalue - 1))
plainText += chr(cipherValue)
print(plainText)
Enter the coded text: Lezi$e$kviex$wyqqiv$fvieo Enter the distance value: 4 #ave?agreat2 summer2 break