-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge01.py
More file actions
31 lines (23 loc) · 758 Bytes
/
challenge01.py
File metadata and controls
31 lines (23 loc) · 758 Bytes
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
#!/usr/bin/env python
# encoding: utf-8
"""
challenge1.py
http://www.pythonchallenge.com/pc/def/map.html
Created by whimsy on 2010-08-29.
Copyright (c) 2010 Will Crawford. All rights reserved.
This solution is confirmed to work. An alternative uses string.maketrans.
"""
import sys
import os
def main():
a = list("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.")
for i in range(0,len(a)):
if a[i] not in [" ", "(", ")", ".", "'"]:
a[i] = chr(ord(a[i]) + 2)
if ord(a[i]) > ord('z'):
a[i] = chr(ord(a[i]) - 26)
s = ''.join(a)
print s
return 0
if __name__ == '__main__':
main()