Question
text file: https://www.dropbox.com/s/a25gcylrcjiqzi6/text.txt?dl=0 in python Write a programthat uses a dictionary to assign codes to each letter of the alphabet. For example: CODE = {'A':')','a':'0','B':'(','b':'9','C':'*','c':'8',
text file: https://www.dropbox.com/s/a25gcylrcjiqzi6/text.txt?dl=0
in python
Write a programthat uses a dictionary to assign codes to each letter of the alphabet. For example:
CODE = {'A':')','a':'0','B':'(','b':'9','C':'*','c':'8',\
'D':'&','d':'7','E':'^','e':'6','F':'%','f':'5',\
'G':'$','g':'4','H':'#','h':'3','I':'@','i':'2',\
'J':'!','j':'1','K':'Z','k':'z','L':'Y','l':'y',\
'M':'X','m':'x','N':'W','n':'w','O':'V','o':'v',\
'P':'U','p':'u','Q':'T','q':'t','R':'S','r':'s',\
'S':'R','s':'r','T':'Q','t':'q','U':'P','u':'p',\
'V':'O','v':'o','W':'N','w':'n','X':'M','x':'m',\
'Y':'L','y':'l','Z':'K','z':'k','!':'J','1':'j',\
'@':'I','2':'i','#':'H','3':'h','$':'G','4':'g',\
'%':'F','5':'f','^':'E','6':'e','&':'D','7':'d',\
'*':'C','8':'c','(':'B','9':'b',')':'A','0':'a',\
':':',',',':':','?':'.','.':'?','<':'>','>':'<',\
"'":'"','"':"'",'+':'-','-':'+','=':';',';':'=',\
'{':'[','[':'{','}':']',']':'}'}
Using this example, the letter A would be assigned the symbol %, the letter
a would be assigned the number 9, the letter B would be assigned the symbol @, and so forth. The program should open a specified text file, read its contents, and then use the dictionary to write an encrypted version of the files contents to a second file. Each character in the second file should contain the code for the corresponding character in the first file.
Write a second program that opens an encrypted file and displays its decrypted contents on the
screen.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started