I'm writing a program that is supposed to perform a Caesar cipher and decipher. I have written the cipher portion but am a little confused about the decipher program.My plan so far is to look at all 26 possible encryptions of the input string. Then, I will decide on which is "best" by using a letter frequency function. I guess Iknow what my plan is, but I'm lost when it comes to writing the code. Help!Here's my encipher code...def cipher(text, n):new_text=""for char in text:s1= ord(char)+nif char.isalpha():if s1> ord('z'):s1-= ord('z')+1-ord('a')new_text= new_text+ chr(s1)else:new_text= new_text+ charprint new_text
Are there any questions left?
New questions in the section Engineering
-
Engineering 2022-05-15 19:04:59