Revision: 12033
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 28, 2009 00:26 by Valdemarick
Initial Code
def rot(s, n=13): r = "" for c in s: cc = c if cc.isalpha(): cc = cc.lower() o = ord(cc) ro = (o+n) % 122 if ro == 0: ro = 122 if ro < 97: ro += 96 cc = chr(ro) r = ''.join((r,cc)) return r
Initial URL
Initial Description
This function takes 2 arguments, first is the string to be encoded (or decoded) the second is optional and can be used to change the rotation amount to something other than 13.
Initial Title
Flexible Rot13 Function
Initial Tags
python
Initial Language
Python