pythonchallenge网站关卡解答

 1 # _*_ coding:utf-8 _*_
 2 translated = ''
 3 message = '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.'
 4 LETTERS = 'abcdefghijklmnopqrstuvwxyz'
 5 for letter in message:
 6     if letter in LETTERS:
 7         num = LETTERS.find(letter) 
 8         num = num + 2
 9         if num > 25:
10             num = num - 26
11         translated = translated + LETTERS[num]
12     else:
13         translated = translated + letter
14 print translated
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.
[Finished in 24.1s]

第二关:http://www.pythonchallenge.com/pc/def/ocr.html

   仅允许非商业转载,转载请注明出处

原文地址:https://www.cnblogs.com/Archimedes/p/7066972.html