[Tutor] comapring lists

Max Noel maxnoel_fr at yahoo.fr
Wed Dec 1 04:13:57 CET 2004


On Dec 1, 2004, at 03:03, Kent Johnson wrote:

> If you want to stay within the same character set you need to do some 
> wraparound at the ends, otherwise you have things like
> >>> chr(ord('9') + 1)
> ':'
> >>> chr(ord('Z') + 1)
> '['

	For that, it's best to use the modulo operator (%), of course. The 
"general" algorithm is something like:

character = base_offset + ((original - base_offset + key) % size)

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list