Advertisement
calcpage

CSH2012 LAB8 ROT13.py

May 8th, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. #!/usr/bin/python
  2. #rot13encoder.py    MrG 2013.0428
  3. email = raw_input("enter email: ")
  4. print "original email: ", email
  5.  
  6. encoded=""
  7. for i in range(len(email)):
  8.     if (ord(email[i])>=97 and ord(email[i])<=122):
  9.         encoded =  encoded + chr(((ord(email[i])+13)-97)%26+97)
  10.     elif (ord(email[i])>=65 and ord(email[i])<=90):
  11.         encoded =  encoded + chr(((ord(email[i])+13)-65)%26+65)
  12.     else:
  13.         encoded =  encoded + email[i]
  14. print
  15. print "encoded email:  ", encoded
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement