Question: Write a program that uses a dictionary to assign codes to each letter of the alphabet. For example: Using this example, the letter A would

Write a program that uses a dictionary to assign “codes” to each letter of the alphabet. For example:codes { 'A' : '%', 'a' '9', 'B' '@', 'b': '#', etc...}

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, then use the dictionary to write an encrypted version of the file’s 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.

codes { 'A' : '%', 'a' '9', 'B' '@', 'b': '#', etc...}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python def encryptfilepath dictionary Encrypts a text file using a dictionary Args filepath The pa... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Starting Out With Python Questions!