Python Challenge

解决了‘开胃菜’,现在才真正的开始。第一题:

http://www.pythonchallenge.com/pc/def/map.html

这道题首先看到的就是本上写的

K->M
O->Q
E->G

下面的黄字意思:

每个人在解决问题之前需要思考两次

这是在逗我吗??思考n次我也想不出。。。

但是看下面的红字母,看的就像是无规则的组合,但是还是26个字母,根据本子上对应关系,我们能想到以前的加密方式,字母向后推。

K对应M,O对应Q,E对应G,都是向后推了2次,2!2!2,这不就对应了想两次吗!红字母这么多,显然是写程序了(手动翻译就是侮辱程序员三个字啊!!!)

Python代码:

 1 import string
 2 _str = "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."
 3 
 4 result = ''
 5 letter = string.ascii_lowercase
 6 for i in _str:
 7     if i in letter:
 8         index = letter.find(i)
 9         index = index+2 if index<24 else index-24
10         result = result + letter[index]
11         continue
12     result = result + i
13     
14 print(result)

最后得到的:

1 i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url.

 that's why this text is so long......

忙活了半天还是被作者耍了,那没办法谁让人家最大呢,那就翻译url的map吧。

结果就是:

ocr

将ocr替换map即可进入下一关。

原文地址:https://www.cnblogs.com/liyang93/p/6597039.html