zoukankan      html  css  js  c++  java
  • python challenge

    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()

  • 相关阅读:
    SQL中如何用一个表的列更新另一个表的列?
    ASPxGridView利用CheckBox实现全选
    DevExpress.NETv8.1(Web Controls)学习笔记
    ALSA vs OSS
    video telephone
    uClinux系统分析 转
    Using KVM On Ubuntu 7.10 (Gutsy Gibbon)转
    想买开发板,我真的需要么?
    uClinux的内存管理转
    各种开源软件授权方式的选择 (zt)
  • 原文地址:https://www.cnblogs.com/zhxiang/p/3377932.html
Copyright © 2011-2022 走看看