Question: pls use Python do this Problem . Code-breaking Your friend, who is also taking CS 111, is really excited about the program she wrote for

pls use Python do this
Problem . Code-breaking
Your friend, who is also taking CS 111, is really excited about the program she wrote for Problem 1 of this problem set. She sends you emails, but theyre all encrypted with the Caesar cipher!
The problem is, you dont know which shift key she is using. The good news is, you know your friend only speaks and writes English words. So if you can write a program to find the decoding that produces the maximum number of words, you can probably find the right decoding (Theres always a chance that the shift may not be unique. Accounting for this would probably use statistical methods that we wont require of you.)
Implement find_best_shift. This function takes a wordlist and a bit of encrypted text and attempts to find the shift that encoded the text. A simple indication of whether or not the correct shift has been found is if all the words obtained after a shift are valid words. Note that this only means that all the words obtained are actual words. It is possible to have a message that can be decoded by two separate shifts into different sets words. While there are various strategies for deciding between ambiguous decryptions, for this problem we are only looking for a simple solution.
To assist you in solving this problem, we have provided a helper function: is_word(wordlist, word). This simply determines if word is a valid word according to wordlist. This function ignores capitalization and punctuation.
Hint: You may find the function str.split to be useful for dividing the text up into words.
def find_best_shift(wordlist, text):
"""
Decrypts the encoded text and returns the plaintext.
text: string
returns: 0 <= int 27
Example:
>>> s = apply_coder('Hello, world!', build_encoder(8))
>>> s
'Pmttw,hdwztl!'
>>> find_best_shift(wordlist, s) returns
8
>>> apply_coder(s, build_decoder(8)) returns
'Hello, world!'
"""
### TODO

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!