[Tutor] Simple ROT-13 Script
matthewmhoffman at hotmail.com
Mon Feb 2 23:36:50 EST 2004
Hello all! I have been reading this list for a goodly amount of time and
have never felt worthy to submit a question until now.
I just wrote a quick one-off script and I would like your opinions on any
Python-isms. It's just a ROT-13 script (I got a Neal Stephenson book for
xmas). I would just like to entertain your thoughts about what I could have
done better, etc. Cheers! ~Matt
encrypt = lambda s: chr(ord(s) + 13)
decrypt = lambda s: chr(ord(s) - 13)
s = 'guido'
r = map(encrypt, s)
t = map(decrypt, r)
['t', '\x82', 'v', 'q', '|']
['g', 'u', 'i', 'd', 'o']
Find high-speed net deals comparison-shop your local providers here.
More information about the Tutor