Question: Could you please edit this code to be able to encrypt an entire file of text if needed and expect a input file an output

Could you please edit this code to be able to encrypt an entire file of text if needed and expect a input file an output file and step distance?
code = input("Enter the coded text ")
distance = int(input("Enter the distance value "))
plainText =""
for ch in code:
ordvalue = ord(ch)
cipherValue = ordvalue - distance
if cipherValue < ord('a'):
cipherValue = ord ('z')-(distance-(ord('a')- ordvalue -1))
plainText += chr(cipherValue)
print(plainText)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!