[Edu-sig] Thinking about my class...

Scott David Daniels Scott.Daniels at Acm.Org
Sat Mar 18 01:28:55 CET 2006


kirby urner wrote:
> Early AM before school in Portland, and my Brother multifunction
> printer, soon to be retired (factory remanufactured clone enroute,
> after we broke the paper feeder), is printing up a storm.
> 
> We'll be doing a simple substitution cipher, i.e. substitute a random
> shuffle (permutation) of A-Z and space, for some coherent plaintext
> (also in Latin-1), to get garbled ciphertext, then reverse.
> 
> Here's my worksheet (decrypt not included): ...
> 
> def makefunction():
>    theletters = list(uppercase[:26] + ' ')
>    copyof = theletters[:]
>    shuffle(copyof)
>    return dict(zip(theletters, copyof))

You could go:

     def makefunction():
         theletters = uppercase[:26] + ' '
         copyof = list(theletters)  # reason: to allow a shuffle
         shuffle(copyof)
         return dict(zip(theletters, copyof))


-- 
-- Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Edu-sig mailing list