Question: Modify the scripts of Programming Exercises 1 and Programming Exercise 2 to encrypt and decrypt entire files of text. ( LO: 4 . 1 ,

Modify the scripts of Programming Exercises 1 and Programming Exercise 2 to encrypt and decrypt entire files of text. (LO: 4.1,4.5) So this is what I have for the encrypt portion for Exercise 1 encrypt.py
# Put your code here
textCode = input("Please enter the coded text: ")
distance = int(input("Please enter the value of distance: "))
plainText =""
for char in textCode:
ordValue = ord(char)
cipherValue = ordValue + distance
if cipherValue >127:
cipherValue = distance -(127- ordValue +1)
plainText += chr(cipherValue)
print(plainText) This is what I have for decryption for Exercise 2 decrypt.py
# Write your program here
# Request the inputs
codedText = input("Enter the coded text: ")
distanceValue = int(input("Enter the distance value: "))
# Calculate the decryption
plainText =""
for ch in codedText:
ordValue = ord(ch)
cipherValue = ordValue - distanceValue
if cipherValue <0:
cipherValue =127-(distance -(1- ordValue))
plainText += chr(cipherValue)
print(plainText) Can you please show me how to Modify encrypt and decrypt scripts to encrypt and decrypt entire files of text by using what I have?

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 Databases Questions!