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:
both images are from one question. I need it in python, please.
Note: Please indent the code as per the screenshots.
Code Screenshots (encrypt.py):


Sample Input File (encrypted.txt):

Sample Output:

Sample Output File(out.txt):

Code To Copy (encrypt.py):
#Prompt the user to enter
#the name of the input file.
infileName = input("Enter the input file name: ")
#Prompt the user to enter
#the name of the output file.
outFileName = input("Enter the output file name: ")
#Prompt the user to enter
#the distance value.
distance = int(input("Enter the distance value: "))
#Open the input file to be read.
inFile = open(infileName,"r")
#Open the output file.
outFile = open(outFileName,"w")
code = ""
#Read the data in the file
#character by character.
for line in inFile.readlines():
flag = 0
if '\n' in line:
flag = 1
line = line.strip('\n')
for ch in line:
ordValue = ord(ch)
cipherValue = ordValue + distance
if cipherValue > 127:
cipherValue = distance - (127 - ordValue + 1)
code += chr(cipherValue)
if flag == 1:
code += '\n'
#Write the data
#to the file.
outFile.write(code)
#Close the files.
inFile.close()
outFile.close()
Code Screenshots (decrypt.py):

Sample
input file (out.txt):

Sample Output:
Sample
Output file (decry.txt):

Code To Copy (decrypt.py):
#Define the function to
#decode the cipher text.
def decode_ceasor(encrypted_text, distance):
output = ""
for i in encrypted_text:
x = ord(i) - (distance % 26)
if i.isalpha():
if i.isupper():
if x > ord('Z'):
x = x - 26
elif x < ord('A'):
x = x + 26
output += chr(x)
else:
output += chr(x)
return output
#Prompt the user to enter
#the name of the input file.
infileName = input("Enter the input file name: ")
#Prompt the user to enter
#the name of the output file.
outFileName = input("Enter the output file name: ")
#Prompt the user to enter
#the distance value.
distance = int(input("Enter the distance value: "))
#Open the input file to be read.
inFile = open(infileName,"r")
#Open the output file.
outFile = open(outFileName,"w")
decrypted_text = ""
for encrypted_text in inFile:
flag = 0
if '\n' in encrypted_text:
flag = 1
#Read the text from the file.
encrypted_text = encrypted_text.strip('\n')
decrypted_text += decode_ceasor(encrypted_text,distance)
if flag == 1:
decrypted_text += '\n'
#Call the function decode_ceaser()
# and write the decoded
#text into the output file.
outFile.write(decrypted_text)
#Close the file.
outFile.close()
inFile.close()
Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text....
Opening Files and Performing File Input in
C++
Opening Files and Performing File Input 1 V/ Flowers.cpp This program reads nanes of flowers and whether they are grown in shade or sun from an input 2 file and prints the information to the user's screen. 3 Input: flowers.dat 41 Output: Names of flowers and the words sun or shade Summary In this lab, you open a file and read input from that file in a prewritten C++ program. The program...
1. Write a C++ program called Password that handles encrypting a
password.
2. The program must perform encryption as follows:
a. main method
i. Ask the user for a password.
ii. Sends the password to a boolean function called
isValidPassword to check validity.
1. Returns true if password is at least 8 characters long
2. Returns false if it is not at least 8 characters long
iii. If isValidPassword functions returns false
1. Print the following error message “The password...
1. You are given a C file which contains a partially completed
program. Follow the instructions contained in comments and complete
the required functions. You will be rewriting four functions from
HW03 (initializeStrings, printStrings, encryptStrings,
decryptStrings) using only pointer operations instead of using
array operations. In addition to this, you will be writing two new
functions (printReversedString, isValidPassword). You should not be
using any array operations in any of functions for this assignment.
You may use only the strlen() function...
For milestone #1, we will start the CARIT site with three static HTML pages and a CSS file. Create a dedicated folder for this project. This folder should contain all related files in this project. The future milestones are cumulative and built directly on top of your prior work. Function/content requirements: A home page named “index.html”, which include these contents at least: Description of the center. You may reference the example sites. Latest news: use list tags; make up some...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...