六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 31|回复: 0

Python Challenge (level 1)

[复制链接]

升级  62%

120

主题

120

主题

120

主题

举人

Rank: 3Rank: 3

积分
386
 楼主| 发表于 2013-2-7 15:45:42 | 显示全部楼层 |阅读模式
URI: http://www.pythonchallenge.com/pc/def/map.html




说明:
图片中显示出字符转换的规律k->m, o->q, e->g
提示用string.maketrans()

解决方法:
import stringoriginal = "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."table = string.maketrans(    "abcdefghijklmnopqrstuvwxyz", "cdefghijklmnopqrstuvwxyzab")print original.translate(table)
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.

print "map".translate(trans)
ocr

过关答案:
ocr
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表