Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1613739
  • 博文数量: 245
  • 博客积分: 10378
  • 博客等级: 上将
  • 技术积分: 2571
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-27 08:19
文章分类

全部博文(245)

文章存档

2013年(4)

2012年(8)

2011年(13)

2010年(68)

2009年(152)

分类: Python/Ruby

2010-11-16 20:51:29

挑战地址:  
 
图片提示:
     k -->  m
     o -->  Q
     e  --> g
其实真正的规律就是 所有的字母替换为字母表中顺序的第三个字母,
比如字母表:
 

alphabet=[ 'a','b','c','d','e','f','g','h','i','j','k','l',\
           'm','n','o','p','q','r','s','t','u','v','w','x','y','z']


将a替换为c  b替换为d

结尾的几个字母,从字母表头开始替换,比如y替换为a  z替换为b

代码:

src ="map 11 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"

alphabet=[ 'a','b','c','d','e','f','g','h','i','j','k','l',\
           'm','n','o','p','q','r','s','t','u','v','w','x','y','z']
dst=""
for i in src:
    #print( i )
    if i.isalpha():
        try:
            index = alphabet.index(i)
            if index <= 22:
                print("<=23 index=%d"%index)
                dst += alphabet[index+2]
            else:
                print(">23 index=%d"%index)
                dst += alphabet[index+2-26]
        except Exception:
            continue
    else:
        dst += i
      
print("dst= %s"%dst)


输出结果是:

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

有意思;

过关:

原始链接为:

     后缀为map.html,按照上文的道理替换,则新的连接为:

过关!!

 

阅读(958) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~