-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2.py
36 lines (31 loc) · 803 Bytes
/
2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
__author__ = 'gongzhi'
'''
url = http://www.pythonchallenge.com/pc/def/map.html
'''
def translate(org):
res = ""
for i in range(len(org)):
if(org[i] == " "):
res += org[i]
elif(org[i] == "."):
res += org[i]
elif(org[i] == "'"):
res += org[i]
elif(org[i] == "("):
res += org[i]
elif(org[i] == ")"):
res += org[i]
elif(org[i] == "y"):
res += "a"
elif(org[i] == "z"):
res += "b"
else:
int_a = ord(org[i])
res += chr(int_a + 2)
return res
if __name__ == "__main__":
print 'Question 2'
org = "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."
print translate(org)
url = "map"
print translate(url)