Need help on this piece of a program: So i needed to encrypt a text file by putt
ID: 3767762 • Letter: N
Question
Need help on this piece of a program:
So i needed to encrypt a text file by putting a 5 after every character. Now I am asked to take a file encrypted this way, and decrypt out the 5's. Is there a way to dejoin, or is it not going to be as straight forward? Keep in mind this is for an intro level Python3 class.
def Encrypt():
newName = input("Enter a name for the new encyrpted file: ")
infile = open("copy.txt", "r")
outfile = open(newName, "w")
data = infile.read()
data = "5".join(data)
outfile.write(data)
infile.close()
outfile.close()
Explanation / Answer
newName = input("Enter a name for the new encyrpted file: ")
infile = open("copy.txt", "r")
outfile = open(newName, "w")
data = infile.read()
data = "5".join(data)
outfile.write(data)
infile.close()
outfile.close()
def encryption():
newname=input(“Enter a name for the new encrypted file:”)
newname=int(newname)
dummy=5
inputfilename=(“copy.text”,”w”)
outputfilename=open(newName,”w”)
mykey=5
mymode=‘encrypt’
if not os.path.exists(input filename)
print(the file doesnot exist.quit(input filename)
sys.exit()
data=inputfilename.read()
data=“5”.join(data)
fileobj=open(inputfile)
pp=fileobj.read(data)
inputfile.close()
print(Mymode.name())
starttime=time.time()
if mymode==‘encrypt’
translated=transpositionencrypt.encrypt(mykey,5)
print(’total time,newsman,5’)
outputfileobj=open(output filename,’w’)
outputfileobj.write(translated)
outputfile.close()
print(output filename)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.