Last active
December 14, 2015 12:59
-
-
Save sauravtom/5090467 to your computer and use it in GitHub Desktop.
My solution python challenge 1 http://www.pythonchallenge.com/pc/def/map.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| text ='''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.''' | |
| def trans(string): | |
| poop='' | |
| for i in string: | |
| #if i in ['.' , ',' , ')' , '(' , "'"," "]: #dont translate special characters | |
| if in in " .,'():;": | |
| poop+=i | |
| else: | |
| if ord(i)<ord('y'): | |
| poop+=chr(ord(i)+2) | |
| else: # we dont want { to come after(in ascii code) z , instead of a, do we ? | |
| poop+=chr(ord(i)-24) | |
| return poop | |
| print text | |
| print trans(text) | |
| print trans('map') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment