dynamic assigments

Tim Leslie tim.leslie at gmail.com
Thu Mar 24 23:08:52 EDT 2011


On 25 March 2011 13:51, scattered <tooscattered at gmail.com> wrote:
> Here is another possibility: you are using Python *interactively* in
> solving cryptograms (as a matter of fact - I was doing exactly this
> yesterday in trying to solve some Playfair ciphers). You have a
> ciphertext that is a stream of letters in the range A...Z. You need to
> consult frequencies of letters, pairs of letters, triples of letters,
> and quadruples of letters that occur. So, you write a script that
> steps through the cipher text, creates a dictionary which records
> frequencies of strings of length <= 4, and, as an added convienence,
> creates bindings of frequencies to these strings. Thus - if you want
> to know how often, say, EFW occurs in the ciphertext you just type EFW
> (rather than freq["EFW"])

And what happens when you want to know the frequency of "if", "def",
"for" or any other variable which matches a keyword?

Tim



More information about the Python-list mailing list