[Tutor] Simple ROT-13 Script

Karl Pflästerer sigurd at 12move.de
Tue Feb 3 09:13:09 EST 2004


On  3 Feb 2004, don arnold <- darnold02 at sprynet.com wrote:

> And in case you didn't know, the reason you want it to wrap around is so
> that you only need a single  rot13() function, not individual encrypt() and
> decrypt() functions:

>>>> print rot13('abc')
> nop
>>>> print rot13('nop')
> abc

Right. And you should take care, that only characters are moved.
Numbers or punctuation signs e.g. are not touched.

>>> s = "Guido 123; Tim 456"
>>> s.encode('rot13')
'Thvqb 123; Gvz 456'
>>> _.encode('rot13')
'Guido 123; Tim 456'
>>> 



   Karl
-- 
Please do *not* send copies of replies to me.
I read the list




More information about the Tutor mailing list