python challenge - map.py
Hint: K->M O->Q E->G
everybody thinks twice before solving this.
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.
General tips:
- Use the hints. They are helpful, most of the times.
- Investigate the data given to you.
- Avoid looking for spoilers.
#!/usr/bin/env python
# http://www.pythonchallenge.com/pc/def/map.html
import string
str1 = "abcdefghijklmnopqrstuvwxyz"
str2 = "cdefghijklmnopqrstuvwxyzab"
transtr = string.maketrans(str1, str2)
aimstr = "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."
print aimstr.translate(transtr)
或
#!/usr/bin/python
# http://www.pythonchallenge.com/pc/def/map.html
import string
tr=string.maketrans(string.lowercase,string.lowercase[2:]+string.lowercase[:2])
s="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."
print s.translate(tr)
输出:
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/ocr.html
字符串maketrans(),translate()
python challenge - map.py的更多相关文章
- python challenge - orc.py
http://www.pythonchallenge.com/pc/def/ocr.html recognize the characters. maybe they are in the book, ...
- Python【map、reduce、filter】内置函数使用说明(转载)
转自:http://www.blogjava.net/vagasnail/articles/301140.html?opt=admin 介绍下Python 中 map,reduce,和filter 内 ...
- 【转】Python 中map、reduce、filter函数
转自:http://www.blogjava.net/vagasnail/articles/301140.html?opt=admin 介绍下Python 中 map,reduce,和filter 内 ...
- python challenge第1关--NoteBook上的“乱码”
在 python challenge第0关中已经得到第1关的地址了: http://www.pythonchallenge.com/pc/def/map.html 一.观察地址栏和标签: What a ...
- The Python Challenge 谜题全解(持续更新)
Python Challenge(0-2) The Python Challengehttp://www.pythonchallenge.com/ 是个很有意思的网站,可以磨练使用python的技巧, ...
- The Python Challenge 0-4
The Python Challenge 0-4 项目地址:http://www.pythonchallenge.com/ Level-0 提示Hint: try to change the URL ...
- 使用Python实现Map Reduce程序
使用Python实现Map Reduce程序 起因 想处理一些较大的文件,单机运行效率太低,多线程也达不到要求,最终采用了集群的处理方式. 详细的讨论可以在v2ex上看一下. 步骤 MapReduce ...
- Python Challenge 第一关
偶然在网上看到这个,PYTHON CHALLENGE,利用Python语言闯关,觉得挺有意思,就记录一下. 第0关应该算个入口吧,试了好几次才试出来,没什么代码就不写了.计算一个结果出来就行. 第一关 ...
- The Python Challenge 闯关笔记
The Python Challenge : http://www.pythonchallenge.com/ Level 0: 看提示图片中为2**38,计算值为274877906944. Hint: ...
随机推荐
- hdu5967
看到合肥赛区的题目都是泪啊,期末考完了来补几道 公正来说,这道题我考场确实写不出来,因为我的lct模板不够完美…… 我在学习lct的时候不知道为什么代码里加边.删边都是用了一个makeroot的操作 ...
- SPOJ GSS2 - Can you answer these queries II(线段树 区间修改+区间查询)(后缀和)
GSS2 - Can you answer these queries II #tree Being a completist and a simplist, kid Yang Zhe cannot ...
- 【kd-tree】bzoj4066 简单题
同p1176. #include<cstdio> #include<cmath> #include<algorithm> using namespace std; ...
- 【Trie】bzoj1212 [HNOI2004]L语言
枚举每个文章里已经在Trie中被标记为可能是分割处的字符,然后再从此处跑Trie,继续向后标记.由于单词数很少,因此复杂度可以接受,O(n*m*Len). #include<cstdio> ...
- [JOISC2014]JOIOJI
题目大意: 给你一串仅包含'J''O''I'的字符串,问满足三种字符出现次数相等的最大字串是多少? 思路: 用map存一下出现次数前缀和两两之差出现的最早位置,每次看一下当前的两两之差最早的出现位置是 ...
- [测试技术分享]easyFuzzer使用案例分享
easyFuzzer使用案例分享 1.简介: easyFuzzer是wooyun的一位白帽子(光刃)提供的一款用于fuzz文件的工具.平时主要是和网络协议安全打交道,和本地软件安全打交道比较少,所以没 ...
- 让旧的的Mac也能免费安装keynote
苹果在美国时间9月10日上午10时,将免费iworks. 听到此消息,我心情激动. 立马升级了操作系统 . 然后搜索keynote ,发现还是收费的. 非常郁闷.. 上网上了解,有如下说明: 20 ...
- 关于数字、数据处理的几个PHP函数汇总
1. / 得到的结果是浮点数 2. % 求余数 3.ceil():得到大于当前数字的整数 $num=3.4; $num=ceil($num); echo $num; 的到的结果是4 $num=3. ...
- mormot 直接使用UNIDAC引擎操作数据库
mormot 直接使用UNIDAC引擎操作数据库 MORMOT封装了BDE.FIREDAC.UNIDAC.Nexus 四种通用型数据库引擎,形成了自己独特的数据引擎控件.前提条件是首先要安装通用型数据 ...
- 【js】js中const,var,let区别
在node.js使用例子中,第一次看到const的声明,查询了一下,可以看得出来: http://www.cnblogs.com/ksl666/p/5944718.html 参考 主要内容是:js中三 ...