IN PYTHON: Decrypting with ascii I have a file called 'dict.txt'. This file contains over 50,000 english words. One word from this file is used as a key (we do not know which one of course). Some have capital letters. I have another file called 'decrypt.txt' which is a file containing a string of numbers i must decrypt using a key found in the 'dict.txt'. This 'decrypt.txt' file message has length of 300. My question is, since i do not know which word (from the file with the 50,000+ words) is the key I must use to decrypt the other file, how do I write a function that: loops through all possible keys from 'dict.txt' to find the one that decrypts my file 'decrypt.txt' best? Somehow i must count how many 'words' are actual words to determine which key is best and then print my final decrypted message.
IN PYTHON: Decrypting with ascii
I have a file called 'dict.txt'. This file contains over 50,000 english words. One word from this file is used as a key (we do not know which one of course). Some have capital letters.
I have another file called 'decrypt.txt' which is a file containing a string of numbers i must decrypt using a key found in the 'dict.txt'. This 'decrypt.txt' file message has length of 300.
My question is, since i do not know which word (from the file with the 50,000+ words) is the key I must use to decrypt the other file, how do I write a function that:
loops through all possible keys from 'dict.txt' to find the one that decrypts my file 'decrypt.txt' best? Somehow i must count how many 'words' are actual words to determine which key is best and then print my final decrypted message.

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images

i get the error: "ord() expected a character, but string of length 6 found".
the first 10 lines of the 'dict.txt' file look like this:
['A', 'a', 'Aachen', 'Aalborg', 'aardvark', 'Aarhus', 'Aaron', 'AB', 'Ab', 'abaci']
the error refers to the first item that contains more than one character 'Aachen'. Does this mean i must somehow convert the file in which it separates all the words first into characters like ['A','a','c','h','e','n']? How would I do this?








