[Tutor] (no subject)
Nidian Job-Smith
nidianjs at hotmail.com
Thu Nov 17 14:14:42 CET 2011
Hi all,
I'm new to programming (thus Python), so after reading the basics, I wanted to practise what I've learnt . I've come across a beginners exercise which is to programme rot13.
I've written some code but it doesn't seem to work....
Here it is:
def rot13(s): char_low = () result = "" if not s.isalpha(): return char char_low = char_low.lower() if char_low <= 'm': dist = 13 else: dist = -13 char = chr(ord(char) + dist) def rot13_char(ch): return ''.join( rot13(s) for char in ch )
Any idea where i'm wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111117/4000efdf/attachment.html>
More information about the Tutor
mailing list