[Edu-sig] Thinking about my class...
kirby.urner at gmail.com
Thu Mar 16 16:51:57 CET 2006
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):
from random import shuffle
from string import uppercase
theletters = list(uppercase[:26] + ' ')
copyof = theletters[:]
return dict(zip(theletters, copyof))
def encrypt(plaintext, thekey):
return ''.join([ thekey[i] for i in plaintext ] )
Use File | New Window to start a new program file.
Save As "something.py" (in site-packages would be OK).
Enter the above code, paying attention to indentation.
We import from modules to get additional features.
The file you save is itself a module.
You can import your own modules, as well as modules provided by others.
[ side 2 of this worksheet is something about xml-rpc -- hitting a
Perl utility with a street address, getting back lat/long ]
More information about the Edu-sig