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: ...
随机推荐
- Problem C: 机器翻译【stl-队列】
Problem C: 机器翻译 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 54 Solved: 27[Submit][Status][Web Bo ...
- java中的3大特性之多态
一.多态:一个对象具有多种表现形态(父类的引用类型变量指向了子类的对象) 二.多态的满足条件:1.必须要有继承关系2.必须要有方法的重写 三.int[]a; //a引用类型变量-->//引用in ...
- Android的日志工具Log
Android中的日志工具类是Log(android.util.Log),这个类提供了以下几个方法来供我们打印日志. ♦ Log.v():这个方法用于打印那些最为琐碎的,意义最小的日志信息.对应级别v ...
- 【Heap-Dijkstra】【分层图】bzoj2763 [JLOI2011]飞行路线
建立k+1张图, 在图与图之间,若在原图中x到y有边,就建立从 第i层的x 到 i+1层的y 建边,权值为0.代表一次免费机会. 由于一旦到了第i+1层的图里,则无法回到之前的层,所以免费最多只有k次 ...
- 【动态规划】【最长上升子序列】【贪心】bzoj1046 [HAOI2007]上升序列
nlogn求出最长上升子序列长度. 对每次询问,贪心地回答.设输入为x.当前数a[i]可能成为答案序列中的第k个,则若 f[i]>=x-k && a[i]>ans[k-1] ...
- Asp.Net MVC part2 View、Controller详解
View详解Razor视图引擎简介HtmlHelper强类型页面 Razor视图引擎简介强大的@:表示使用C#代码,相当于aspx中的<%%>可以完成输出功能当遇到html标签时会认为C# ...
- Windows python 3 安装OpenCV
本文适用于想在window下使用python 3 的童鞋,安装openCV 有问题的参考 一.你要确定自己的python版本是3.x,在命令行窗口输入python 本人使用的是python 3.6 二 ...
- iOS开发技巧——Autolayout动画
使用Autolayout时需要在动画的代码前面后面添加 layoutIfNeeded方法 Animation AutoLayout也可以配合传统的animation方法,整体代码结构如下. ...
- 如何让vs2017 EF实体生成支持Mysql 和 Oracle?
1.Mysql 安装 MySql Connector/Net https://dev.mysql.com/downloads/connector/net/ 安装 mysql f ...
- Chrome DevTools 代码覆盖率功能详解
共 1812 字,读完需 3 分钟.工欲善其事必先利其器,前端周刊本周起每周会加餐 1 篇工具技巧,里面辅以动图,让大家看完就能学会,并上手使用.本文会介绍 Chrome Canary 新增的代码覆盖 ...