python3.3.1 pythonchallenge 通关之level 1

        才发现这个好玩的python解题通关网站,http://www.pythonchallenge.com/  今天玩一晚上先~哈哈python3.3.1 pythonchallenge 通关之level 1_第1张图片


        现在开始搞起。网上应该还有别人的解法,我不参考只用自己的方法,供大家博采众长,玩python就是为了开心~哈哈

        第0题没用Python,从第1题开始:

python3.3.1 pythonchallenge 通关之level 1_第2张图片

        k->m,o->q,e->g,意思每个字母加2得到新的字母呗。

>>> a="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."
>>> new=""
>>> for i in range(len(a)):
...     new+=chr(ord(a[i])+2)
... 
>>> new
'i"hope"you"didnt"tr{nsl{te"it"|y"h{nd0"th{ts"wh{t"computers"{re"for0"doing"it"in"|y"h{nd"is"inefficient"{nd"th{t)s"why"this"text"is"so"long0"using"string0m{ketr{ns*+"is"recommended0"now"{pply"on"the"url0'
        这时我才发现提示thinks twice的意义,空格和".","(",")"不用变,再试:

a="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."
new=''
for i in range(len(a)):
	if a[i]==' ' or a[i]=='.' or a[i]=="'" or a[i]=='(' or a[i]==')':
		new+=a[i]
	elif a[i]=='y':
		new+='a'
	elif a[i]=='z':
		new+='b'
	else:
		new+=chr(ord(a[i])+2)
print(new)
输出正确结果为:
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.
链接是 http://www.pythonchallenge.com/pc/def/map.html,把a的字符串换成链接即可,但是http,html这些都是标准的,先把map作为字符串a的输入得到ocr,卧槽勒,果然是2题链接~ 下一篇搞level2,直播中~

转载请注明:转自 http://blog.csdn.net/littlethunder/article/details/8936581



你可能感兴趣的:(python)