Home /
Expert Answers /
Computer Science /
modify-the-scripts-of-projects-1-and-2-to-encrypt-and-decrypt-entire-files-of-text-an-example-of-t-pa794
(Solved): Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text. An example of t ...
Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text. An example of the program interface is shown below: Enter the input file name: encrypted.txt Enter the output file name: a Enter the distance value: 3 Grading When you have completed your program, click the Submit button to record your score.
2 File: encrypt.py Project \( 4.3 \) Encypts a text file. The inputs are the names of the input file and the output file and the distance value. The encrypted code is witten to a new file. (") plaintext = input("Enter a one-word, lowercase message: ") distance = int(input("Enter the distance value: ")) code \( =" \cdots \) for ch in plaintext: ordValue \( = \) ord \( (\mathrm{ch}) \) cipherValue \( = \) ordValue \( + \) distance if ciphervalue > ord \( \left(' z^{\prime}\right): \) ciphervalue \( =\operatorname{ord}\left({ }^{\prime} a^{\prime}\right)+ \) distance \( -1 \) \( \left(\operatorname{ord}\left({ }^{\prime} z^{\prime}\right)\right. \) - ordValue \( \left.+1\right) \) code \( +=\operatorname{chr} \) (cipherValue) print (code)