Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Input is Hello world 4 My output text to encrypt: Hellow world distace: 4 Lipps$asvph the problem is that its supposed to be Lipps${svph and
Input is
Hello world
4
My output
text to encrypt: Hellow world
distace: 4
Lipps$asvph
the problem is that its supposed to be Lipps${svph and im not sure how what i did wrong and what im supposed to do.
plainText = input("text to encrypt: ")
distance = int(input("distance: "))
code = ""
for ch in plainText:
ordValue = ord(ch)
cipherValue = ordValue + distance
if cipherValue > ord('z'):
cipherValue = ord('a') + distance - (ord('z') - ordValue + 1)
code = code + chr(cipherValue)
print(code)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started