SHARE
TWEET

CSH2012 LAB8 ROT13.py

calcpage May 8th, 2013 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
Top