Anda di halaman 1dari 1

START

Create dictionary named codes


Open codes.txt file
For item in codes
write key and value
Close codes.txt file
Open encryptedCodes.txt
For key in codes
write keys
Close encryptedCodes.txt
Print Message Encryption complete.
For key in codes
print (key)
END

START

Open codes.txt

For item in codes

Write key

Close codes.txt

Open
encryptedCodes.txt

For key in codes

Write key

Close
encryptedCodes.txt
Print Message
Encryption
Complete

For key in codes

END

def main():
codes = {'A':'1', 'a':'!',
'B':'2', 'b':'@',
'C':'3', 'c':'#',
'D':'4', 'd':'$',
'E':'5', 'e':'%',
'F':'6', 'f':'^',
'G':'7', 'g':'&',
'H':'8', 'h':'*',
'I':'9', 'i':'!!',
'J':'10', 'j':'@@',
'K':'11', 'k':'##',
'L':'12', 'l':'%%',
'M':'13', 'm':'^^',
'N':'14', 'n':'&&',
'O':'15', 'o':'@!',
'P':'16', 'p':'@#',
'Q':'17', 'q':'@$',
'R':'18', 'r':'@%',
'S':'19', 's':'@^',
'T':'20', 't':'@&',
'U':'21', 'u':'!@',
'V':'22', 'v':'#@',
'W':'23', 'w':'$@',
'X':'24', 'x':'%@',
'Y':'25', 'y':'&@',
'Z':'26', 'z':'*@',}
outfile = open('codes.txt', 'w')
for item in codes:
outfile.write(item + '\n')
outfile.close()
print("The keys has been written to codes.txt")
outfile = open('codes.txt', 'r')

print("Reading the contents of the codes.txt file and creating an encrypted copy")
outfile.close()

outfile = open('encryptedCodes.txt', 'w')


for key in codes:
outfile.write(codes[key] + '\n')
outfile.close()
print("Encryption complete. View encryptedCodes.txt for encrypted values")
for key in codes:
print(key)
main()

Print(key)

Write value

Anda mungkin juga menyukai