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
Help me with modifying my code. Instruction: Create a module that decrypts the following message. Lezi$e$kviex$wyqqiv$fv
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Help me with modifying my code. Instruction: Create a module that decrypts the following message. Lezi$e$kviex$wyqqiv$fv
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!