Question: Must be in Python 3.6 (please have a screen shot on the code) EX 13.8 CODE def main(): f1 = input(Enter a source filename: ).strip()
Must be in Python 3.6 (please have a screen shot on the code)


EX 13.8 CODE
def main(): f1 = input("Enter a source filename: ").strip() f2 = input("Enter a target filename: ").strip()
# Open files for input infile = open(f1, "r") s = infile.read() # Read all from the file newS = "" for i in range(len(s)): newS += chr(ord(s[i]) + 5)
infile.close() # Close the input file outfile = open(f1, "w") print(newS, file = outfile, end = "") # Write to the file print("Done")
outfile.close() # Close the output file
main()
13.9 (Decrypt files) Suppose a file is encrypted using the scheme in Exercise 13.8. Write a program to decode an encrypted file. Your program should prompt the user to enter an input filename and an output filename and should save the unen- crypted version of the input file to the output file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
