Select Page

QuestionWrite a function decipher(s) that takes as input an arbitrary strings that has already been enciphered by having its characters “rotated” by some amount (possibly 0). decipher should return, to the best of its ability, the original English string, which will be some rotation (possibly 0) of the input string s. For example:>>> decipher(‘Bzdrzq bhogdq? H oqdedq Bzdrzq rzkzc.’)result: ‘Caesar cipher? I prefer Caesar salad.’————–here is programming and I want an explanation for these steps.def decipherHelper(message, distance): decrypt_str = “” for c in message: if 65 <= ord(c) and ord(c) <= 90: if (ord(c) – distance < 65): c = chr(26 + ord(c) – distance) else: c = chr(ord(c) – distance) elif 97 <= ord(c) and ord(c) <= 122: if ord(c) – distance < 97: c = chr(26 + ord(c) – distance) else: c= chr(ord(c) – distance) decrypt_str += c return decrypt_strdef decipher(s): maxScore = 0 maxScoreStr = None for k in range(26): decrypted = decipherHelper(s, k) score = sum([letter_prob(c) for c in decrypted]) if score > maxScore: maxScore, maxScoreStr = score, decrypted return maxScoreStr #return the output string return outputComputer ScienceEngineering & TechnologyPython Programming CAS CS 111

Order your essay today and save 20% with the discount code ESSAYHELP