You will write a function that can be used to decrypt Dan’s encrypted text. You will be given an open file that contains an encrypted passage from one of the books, and the name of a file containing a wordlist of English words. You need to discover the shift value to use (0-25) in order to decrypt the text. A correct shift value is one that leads to the maximum number of words being found in the English list of words. To find the words in the encrypted text, you must call split(). For a given shift value, convert all letters to lowercase, then try to find each word in the English wordlist. Do not remove any punctuation or symbols from the word: for example, if the word is hello!, then that is the exact string, including exclamation mark, that you should try to find in the English wordlist. Your function should return a string where all letters are in lowercase, and all other characters (newlines, spaces, punctuation, etc.) are retained. Input In each test case, we will call your decrypt function with an open file that contains encrypted text, and the name of a file containing an English wordlist. An encrypted file contains the encrypted text; for example, it might look like this: Q svme pm nmtb smmvtg bpm ijamvkm wn pqa wev niuqtg. An English wordlist has one word per line; here is a small example: abases abash abashed abashes abashing abashment Return Value Using the full English wordlist provided in the starter code, your function would return the following string for the above encrypted text: i knew he felt keenly the absence of his own family.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

You will write a function that can be used to decrypt Dan’s encrypted text. You will be given an open file that contains an encrypted passage from one of the books, and the name of a file containing a wordlist of English words. You need to discover the shift value to use (0-25) in order to decrypt the text. A correct shift value is one that leads to the maximum number of words being found in the English list of words.

To find the words in the encrypted text, you must call split(). For a given shift value, convert all letters to lowercase, then try to find each word in the English wordlist. Do not remove any punctuation or symbols from the word: for example, if the word is hello!, then that is the exact string, including exclamation mark, that you should try to find in the English wordlist.

Your function should return a string where all letters are in lowercase, and all other characters (newlines, spaces, punctuation, etc.) are retained.

Input

In each test case, we will call your decrypt function with an open file that contains encrypted text, and the name of a file containing an English wordlist.

An encrypted file contains the encrypted text; for example, it might look like this:

Q svme pm nmtb smmvtg bpm ijamvkm wn pqa wev niuqtg.

An English wordlist has one word per line; here is a small example:

abases abash abashed abashes abashing abashment

Return Value

Using the full English wordlist provided in the starter code, your function would return the following string for the above encrypted text:

i knew he felt keenly the absence of his own family.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY