Question: python Exercise Objectives Using sets Problem Description Write a program that reads in two files and prints out, in sorted order, all words common in

Exercise Objectives Using sets Problem Description Write a program that reads in two files and prints out, in sorted order, all words common in both files. all words that are in the second file but not in the first one. all words that are in both files. Ex 2 Exercise Objectives Using dictionaries working with simple json files Problem Description A simple algorithm to encrypt text is as follows: Calculates the frequency of each word in the text Replaces the most frequent word with word ABC, the second most frequent word with the letter DEF and so on. If the text has more than 9 different words, then restart from ABC. If the text has more than 52 different words, continue with 012 to 789. This is called the key Assume that the text does not contain more than 52 different words Write a function named word_ferq that takes a file name and returns a dictionary containing the frequency of each word in the file Example: Hello all How are you Hello again Welcome all Hello Hello => ABC All => DEF How GHI {"hello":3,"all":2, "How":1} Write a function named encrypt_file that takes as arguments 2 file names. The function should read the text from the first file, encrypt the text according to the algorithm above and store the encrypted text in the second file Write a function named decrypt_file it takes 3 arguments: the name of the encrypted file, the name of the file to store the decrypted text, and the name of the json file containing the key. The function should read the text from the first file, decrypt the text and store the encrypted text in the second file. Write a program that Prompts the user to enter the desired operation (encrypt or decrypt) If the user enter wants to encrypt a text, then: o Prompts the user to enter the name of the text file to be encrypted (the source file) o Prompts the user to enter the name of the file where encrypt d text to be stored Store the key in a json file named key.json If the user enter wants to decrypt a text, then: o Prompts the user to enter the name of the text file to be decrypted (the source file) o Prompts the user to enter the name of the file that contains the key o Prompts the user to enter the name of the file where decrypted text to be stored
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
