Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago