SHARE
TWEET

Ente Isle translator

a guest May 5th, 2013 181 Never
  1. import sys
  2.  
  3. orig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
  4. trans = 'AZYXEWVTISRLPNOMQKJHUGFDCBazyxewvtisrlpnomqkjhugfdcb'
  5. tl_map = dict(zip(orig, trans))
  6.  
  7. def translate(text):
  8.     return ''.join([tl_map.get(x, x) for x in text])
  9.  
  10. def translate_lines():
  11.     while True:
  12.         line = raw_input()
  13.         print ''.join(translate(line))
  14.         if (line == ''):
  15.             break
  16.  
  17. if __name__ == '__main__':
  18.     if len(sys.argv) > 1:
  19.         print translate(' '.join(sys.argv[1:]))
  20.     else:
  21.         translate_lines()
RAW Paste Data
Top