Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions